Skip to content

Docs/example fixes #3687

New issue

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

Merged
merged 11 commits into from
Apr 28, 2025
Merged
Prev Previous commit
Next Next commit
Update ColorPalette snippet to include a functional example with stat…
…e management
  • Loading branch information
ethanshar committed Apr 20, 2025
commit 842a79b103e0f719d245385a901140b9b6f123cc
18 changes: 13 additions & 5 deletions src/components/colorPalette/ColorPalette.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,19 @@
}
],
"snippet": [
"<ColorPalette",
" colors={['transparent', Colors.green30, Colors.yellow30, Colors.red30]$1}",
" value={selectedColor$2}",
" onValueChange={() => console.log('value changed')$3}",
"/>"

"function Example(props) {",
" const [value, setValue] = useState(Colors.yellow30);",
" return (",
" <View flex padding-s5 gap-s4>",
" <ColorPalette",
" colors={['transparent', Colors.green30, Colors.yellow30, Colors.red30]$1}",
" value={value}",
" onValueChange={setValue}",
" />",
" </View>",
" );",
"}"
],
"docs": {
"hero": {
Expand Down