diff --git a/src/stories/Dropdown/Dropdown.stories.tsx b/src/stories/Dropdown/Dropdown.stories.tsx index b1bca32..90c381b 100644 --- a/src/stories/Dropdown/Dropdown.stories.tsx +++ b/src/stories/Dropdown/Dropdown.stories.tsx @@ -27,3 +27,28 @@ MultiDropdown.args = { name: "colors", options: colourOptions, }; + +export const CreatableDropdown = Template.bind({}); +CreatableDropdown.args = { + className: "creatable-single", + defaultValue: colourOptions[0], + name: "color", + onCreateOption: async (inputValue: string) => { + await new Promise((resolve) => setTimeout(resolve, 1000)); + alert(`Creating ${inputValue}`); + }, + options: colourOptions, +}; + +export const CreatableMultiDropdown = Template.bind({}); +CreatableMultiDropdown.args = { + isMulti: true, + className: "creatable-multi", + defaultValue: colourOptions[0], + name: "color", + onCreateOption: async (inputValue: string) => { + await new Promise((resolve) => setTimeout(resolve, 1000)); + alert(`Creating ${inputValue}`); + }, + options: colourOptions, +}; diff --git a/src/stories/Dropdown/index.tsx b/src/stories/Dropdown/index.tsx index 3311584..6276f3f 100644 --- a/src/stories/Dropdown/index.tsx +++ b/src/stories/Dropdown/index.tsx @@ -1,12 +1,17 @@ -import ReactSelect, { Props, GroupBase, StylesConfig } from "react-select5"; -import { aqTheme, customComponents } from "./styles"; +import ReactSelect, { GroupBase, Props, StylesConfig } from "react-select5"; +import Creatable from "react-select5/creatable"; import { aqBootstrapTheme } from "../theme/defaultTheme"; +import { aqTheme, customComponents } from "./styles"; export function Dropdown< Option, IsMulti extends boolean = false, Group extends GroupBase