mirror of
https://github.com/strapi/strapi.git
synced 2025-08-10 01:38:10 +00:00
SelectTree: Improve example
This commit is contained in:
parent
d39b4c6ae7
commit
7c1e90c89d
@ -14,7 +14,7 @@ into `react-select` are forwarded.
|
|||||||
<Canvas>
|
<Canvas>
|
||||||
<Story name="base">
|
<Story name="base">
|
||||||
{() => {
|
{() => {
|
||||||
const [value, setValue] = useState(null);
|
const [value, setValue] = useState({ value: 22, label: "Folder 2.2" });
|
||||||
const options = [
|
const options = [
|
||||||
{
|
{
|
||||||
value: 1,
|
value: 1,
|
||||||
@ -51,8 +51,8 @@ into `react-select` are forwarded.
|
|||||||
];
|
];
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<SelectTree options={options} defaultValue={{ value: 22 }} onChange={({ value }) => setValue(value)} />
|
<SelectTree options={options} defaultValue={value} onChange={({ value, label }) => setValue({ value, label })} />
|
||||||
<p>Selected Value: {value}</p>
|
<p>Selected Value: {value.value}</p>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user