@trousers/styled
@trousers/styled
Default export
SourceCreate a React component from an HTML or SVG element and compiled styles.
The component accepts the element's props and ref, plus $ modifiers and
named variants inferred from the style definition.
const styled: Styled;
Example
const Button = styled.button(buttonStyles);
css
SourceDefine static styles that the bundler plugin extracts into CSS. Apply the
result with classnames, styled, or the JSX css prop. Use React's
style prop for runtime values.
Give the style definition a readable prefix in the emitted class names.
function css(styles: CSSObject): CollectorReturn;
function css(id: string, styles: CSSObject): CollectorReturn;
Example
const button = css('button', { borderRadius: 8 })
.modifier('primary', { backgroundColor: '#f95b5b' });