DocumentationCommunityGitHubSlackSpectrum

Getting Started

IntroductionInstallCSSStyled ComponentsCompositionObject StylesNested SelectorsMedia QueriesGlobal Styles

Advanced

KeyframescxServer Side RenderingAttaching PropsThemingLabelsConfigurable ImportsInstances

Attaching Props

Edit this page

Sometimes it’s useful to create components that already have props applied, like the example below with a password input. You use recompose’s withProps higher-order component to do this.

withProps documentation

import withProps from 'recompose/withProps'

const RedPasswordInput = withProps({
  type: 'password'
})(styled('input')`
  background-color: red;
`)

render(<RedPasswordInput />)
Previous Page
Server Side Rendering
Next Page