Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(cli): wire state into the Bottom Sheet showcase checkboxes (#5157)

Xinzi Zhoudc90488a0790
diff --git a/.changeset/bottom-sheet-showcase-checkbox-state.md b/.changeset/bottom-sheet-showcase-checkbox-state.md
new file mode 100644
index 0000000000..58a8124416
--- /dev/null
+++ b/.changeset/bottom-sheet-showcase-checkbox-state.md
@@ -0,0 +1,9 @@
+---
+'@astryxdesign/cli': patch
+---
+
+[fix] Bottom Sheet showcase block: the filter checkboxes are interactive again.
+
+`CheckboxInput` is fully controlled — `value` is required and the input only moves when the owner updates it. The showcase passed a literal `value={false}` with no `onChange`, so the three filters ("In stock", "On sale", "Free shipping") rendered but could never be toggled: on the docs site the first thing a reader tries in a Bottom Sheet does nothing, and anyone copying the block inherits three dead controls. Each filter now has its own `useState` and `onChange`, matching the checkbox wiring already used in the Bottom Sheet Switcher showcase.
+
+@imdreamrunner
diff --git a/packages/cli/assets/templates/blocks/components/BottomSheet/BottomSheetShowcase.tsx b/packages/cli/assets/templates/blocks/components/BottomSheet/BottomSheetShowcase.tsx
index 8d6f62aa09..97ae2dc7be 100644
--- a/packages/cli/assets/templates/blocks/components/BottomSheet/BottomSheetShowcase.tsx
+++ b/packages/cli/assets/templates/blocks/components/BottomSheet/BottomSheetShowcase.tsx
@@ -13,6 +13,9 @@ import {VStack} from '@astryxdesign/core/Stack';
export default function BottomSheetShowcase() {
const [isOpen, setIsOpen] = useState(false);
+ const [inStock, setInStock] = useState(false);
+ const [onSale, setOnSale] = useState(false);
+ const [freeShipping, setFreeShipping] = useState(false);
return (
<>
@@ -23,9 +26,21 @@ export default function BottomSheetShowcase() {
<Heading level={3}>Filters</Heading>
<Divider />
<VStack gap={2}>
- <CheckboxInput label="In stock" value={false} />
- <CheckboxInput label="On sale" value={false} />
- <CheckboxInput label="Free shipping" value={false} />
+ <CheckboxInput
+ label="In stock"
+ value={inStock}
+ onChange={setInStock}
+ />
+ <CheckboxInput
+ label="On sale"
+ value={onSale}
+ onChange={setOnSale}
+ />
+ <CheckboxInput
+ label="Free shipping"
+ value={freeShipping}
+ onChange={setFreeShipping}
+ />
</VStack>
<Button label="Apply" onClick={() => setIsOpen(false)} />
</VStack>