Skip to content

Commit c5f346b

Browse files
committed
TextArea stories: inline state in Default render to show TextArea in View Code
1 parent 1fbf352 commit c5f346b

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

packages/design-system-react/src/components/TextArea/TextArea.stories.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,19 @@ export const Default: Story = {
7878
value: '',
7979
placeholder: 'Sample placeholder',
8080
},
81-
render: (args) => <ControlledTextArea {...args} />,
81+
render: (args) => {
82+
const [value, setValue] = useState(args.value ?? '');
83+
useEffect(() => {
84+
setValue(args.value ?? '');
85+
}, [args.value]);
86+
return (
87+
<TextArea
88+
{...args}
89+
value={value}
90+
onChange={(event) => setValue(event.target.value)}
91+
/>
92+
);
93+
},
8294
};
8395

8496
export const TextVariantStory: Story = {

0 commit comments

Comments
 (0)