Skip to content

Commit

Permalink
Update apps/docs/docs/learn/06-recipes/02-variants.mdx
Browse files Browse the repository at this point in the history
Co-authored-by: Naman Goel <[email protected]>
  • Loading branch information
aminaopio and nmn authored Dec 5, 2024
1 parent 50114b4 commit d3579d1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion apps/docs/docs/learn/06-recipes/02-variants.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ Here’s how you can create a button component with different visual styles base
import * as stylex from '@stylexjs/stylex';

const styles = stylex.create({
base: {
appearance: 'none',
borderWidth: 0,
},
});

const variants = stylex.create({
primary: {
backgroundColor: {
default: 'blue',
Expand All @@ -38,7 +45,7 @@ const styles = stylex.create({
});

function Button({ variant = 'primary', ...props }) {
return <button {...props} {...stylex.props(styles[variant], props.style)} />;
return <button {...props} {...stylex.props(styles.base, variants[variant], props.style)} />;
}

// Usage
Expand Down

0 comments on commit d3579d1

Please sign in to comment.