Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

⬢ Style props for rapid UI development

License

NotificationsYou must be signed in to change notification settings

styled-system/styled-system

Repository files navigation

Styled System

Responsive, theme-based style props for building design systems with Reacthttps://styled-system.com

starsBuild StatusDownloadsVersionspectrum-badgesizeMIT Licensesystem-ui/theme

npm i styled-system

Features

  • Add style props that hook into your own theme
  • Quickly set responsive font-size, margin, padding, width, and more with props
  • Influenced by constraint-based design system principles
  • Typographic scale
  • Spacing scale for margin and padding
  • Works with any color palette
  • Works with most css-in-js libraries, includingstyled-components &emotion
  • Used inRebass,Reflexbox, and thePriceline Design System

"This is honestly my favourite way to build UI components right nowparty parrot"

Varun Vachhar

"If you haven't seen Styled System before, do yourself a favour and check it out. It's been a huge influence in my thinking on component-oriented styles."

Mark Dalgleish

"The future of css-in-js is going to look something like styled-system with its responsive values."

Kye Hohenberger

"Coming from @tachyons_css, the styled-system utilities from @jxnblk is the missing link I’ve been looking for."

Nathan Young

"If you make websites/apps with React check out Styled System if you haven't already. You will be amazed at how much faster you can build."

David Yeiser

"If you like Tachyons you will love styled-system. If you don't like Tachyons, you will love styled-system."

Adam Morse

"Styled System is one of the best libraries I have ever used."

Miha Sedej

Try It Out

Try theexamples on CodeSandbox

Table of Contents

Usage

// Example uses styled-components, but styled-system works with most other css-in-js libraries as wellimportstyledfrom'styled-components'import{space,layout,typography,color}from'styled-system'// Add styled-system functions to your componentconstBox=styled.div`${space}${layout}${typography}${color}`

Each style function exposes its own set of component propsthat handle styles based on values defined in a theme.

// width: 50%<Boxwidth={1/2}/>// font-size: 20px (theme.fontSizes[4])<BoxfontSize={4}/>// margin: 16px (theme.space[2])<Boxm={2}/>// padding: 32px (theme.space[3])<Boxp={3}/>// color<Boxcolor='tomato'/>// color: #333 (theme.colors.gray[0])<Boxcolor='gray.0'/>// background color<Boxbg='tomato'/>

Responsive Style Props

Set responsive width, margin, padding, font-size, and other properties with a shorthand array syntax.Read more

// responsive width<Boxwidth={[1,1/2,1/4]}/>// responsive font-size<BoxfontSize={[2,3,4]}/>// responsive margin<Boxm={[1,2,3]}/>// responsive padding<Boxp={[1,2,3]}/>

To learn more, see theGetting Started guide or read the docs.

Docs


Further Reading

Built with Styled System

Related

MIT License


[8]ページ先頭

©2009-2025 Movatter.jp