We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define component presets:
const presets = { button: { save: { children: 'Save [ICON]', appearance: 'primary', intent: 'success' }, cancel: { children: 'Cancel', appearance: 'minimal' } } } const App = () => ( <SmashingPresetProvider value={presets}> <Page/> </SmashingPresetProvider> )
Bind preset group to component:
const Button = (props) => { const presetProps = usePreset('button', props) return <button {...presetProps} /> } //or const Button withPreset('button', (props) => { return <button {...props} /> })
Use preset:
const Page = () => ( <> <Button preset="save" /> <Button preset="cancel" appearance="subtle" /> </> )
This will render two buttons with props taken from presets. Preset can be overwritten with a prop: cancel button has appearance overwritten.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Define component presets:
Bind preset group to component:
Use preset:
This will render two buttons with props taken from presets. Preset can be overwritten with a prop: cancel button has appearance overwritten.
The text was updated successfully, but these errors were encountered: