Skip to content

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

TypeScript

docs(cli): make Typeahead/Tokenizer/FileInput showcases interactive (#3201)

Durvesh Pilankara7d67d02026f
diff --git a/.changeset/interactive-showcases-3.md b/.changeset/interactive-showcases-3.md
new file mode 100644
index 0000000000..2ac8f1cab7
--- /dev/null
+++ b/.changeset/interactive-showcases-3.md
@@ -0,0 +1,6 @@
+---
+'@astryxdesign/cli': patch
+---
+
+[docs] Wire local state into the Typeahead, Tokenizer, and FileInput showcase examples (static value + no-op onChange → frozen previews). Completes the interactive-showcase fixes started for Slider/Selector/MultiSelector (#3187-#3189) and the input/tab batch
+@durvesh1992
diff --git a/packages/cli/templates/blocks/components/FileInput/FileInputShowcase.tsx b/packages/cli/templates/blocks/components/FileInput/FileInputShowcase.tsx
index 093af04bab..f2477f4f8b 100644
--- a/packages/cli/templates/blocks/components/FileInput/FileInputShowcase.tsx
+++ b/packages/cli/templates/blocks/components/FileInput/FileInputShowcase.tsx
@@ -2,15 +2,17 @@
'use client';
+import {useState} from 'react';
import {FileInput} from '@astryxdesign/core/FileInput';
export default function FileInputShowcase() {
+ const [value, setValue] = useState<File | File[] | null>(null);
return (
<div style={{width: 350}}>
<FileInput
label="Upload file"
- value={null}
- onChange={() => {}}
+ value={value}
+ onChange={setValue}
placeholder="Drag files here or click to browse"
/>
</div>
diff --git a/packages/cli/templates/blocks/components/Tokenizer/TokenizerShowcase.tsx b/packages/cli/templates/blocks/components/Tokenizer/TokenizerShowcase.tsx
index 751161345d..9752e9bfaf 100644
--- a/packages/cli/templates/blocks/components/Tokenizer/TokenizerShowcase.tsx
+++ b/packages/cli/templates/blocks/components/Tokenizer/TokenizerShowcase.tsx
@@ -2,8 +2,9 @@
'use client';
+import {useState} from 'react';
import {Tokenizer} from '@astryxdesign/core/Tokenizer';
-import type {SearchSource} from '@astryxdesign/core/Typeahead';
+import type {SearchableItem, SearchSource} from '@astryxdesign/core/Typeahead';
const source: SearchSource = {
search: () => [],
@@ -11,16 +12,17 @@ const source: SearchSource = {
};
export default function TokenizerShowcase() {
+ const [value, setValue] = useState<SearchableItem[]>([
+ {id: '1', label: 'Design'},
+ {id: '2', label: 'Engineering'},
+ ]);
return (
<Tokenizer
label="Tags"
placeholder="Search..."
searchSource={source}
- value={[
- {id: '1', label: 'Design'},
- {id: '2', label: 'Engineering'},
- ]}
- onChange={() => {}}
+ value={value}
+ onChange={setValue}
style={{width: 400}}
/>
);
diff --git a/packages/cli/templates/blocks/components/Typeahead/TypeaheadShowcase.tsx b/packages/cli/templates/blocks/components/Typeahead/TypeaheadShowcase.tsx
index 5885e9a344..a2bf08fa63 100644
--- a/packages/cli/templates/blocks/components/Typeahead/TypeaheadShowcase.tsx
+++ b/packages/cli/templates/blocks/components/Typeahead/TypeaheadShowcase.tsx
@@ -1,5 +1,8 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
+'use client';
+
+import {useState} from 'react';
import {Typeahead} from '@astryxdesign/core/Typeahead';
import type {SearchableItem, SearchSource} from '@astryxdesign/core/Typeahead';
@@ -21,14 +24,15 @@ const fruitSource: SearchSource = {
};
export default function TypeaheadShowcase() {
+ const [value, setValue] = useState<SearchableItem | null>(null);
return (
<div style={{width: 320}}>
<Typeahead
label="Fruit"
placeholder="Search fruits..."
searchSource={fruitSource}
- value={null}
- onChange={() => {}}
+ value={value}
+ onChange={setValue}
/>
</div>
);