✨(react) add select multi options custom render
We want to be able to render the options in a customized manner.
This commit is contained in:
@@ -7,7 +7,10 @@ import { faker } from "@faker-js/faker";
|
||||
import { onSubmit } from ":/components/Forms/Examples/ReactHookForm/reactHookFormUtils";
|
||||
import { Select, SelectHandle } from ":/components/Forms/Select";
|
||||
import { Button } from ":/components/Button";
|
||||
import { RhfSelect } from ":/components/Forms/Select/stories-utils";
|
||||
import {
|
||||
getCountryOption,
|
||||
RhfSelect,
|
||||
} from ":/components/Forms/Select/stories-utils";
|
||||
|
||||
export default {
|
||||
title: "Components/Forms/Select/Multi",
|
||||
@@ -216,6 +219,37 @@ export const NoOptions = {
|
||||
},
|
||||
};
|
||||
|
||||
export const CustomRender = {
|
||||
render: Template,
|
||||
args: {
|
||||
label: "Select a country",
|
||||
showLabelWhenSelected: false,
|
||||
options: [
|
||||
getCountryOption("Germany", "DE"),
|
||||
getCountryOption("France", "FR"),
|
||||
getCountryOption("United States", "US"),
|
||||
getCountryOption("Spain", "ES"),
|
||||
getCountryOption("China", "CN"),
|
||||
],
|
||||
},
|
||||
};
|
||||
export const SearchableCustomRender = {
|
||||
render: Template,
|
||||
args: {
|
||||
label: "Select a country",
|
||||
showLabelWhenSelected: false,
|
||||
searchable: true,
|
||||
defaultValue: ["france", "united states"],
|
||||
options: [
|
||||
getCountryOption("Germany", "DE"),
|
||||
getCountryOption("France", "FR"),
|
||||
getCountryOption("United States", "US"),
|
||||
getCountryOption("Spain", "ES"),
|
||||
getCountryOption("China", "CN"),
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
export const Ref = () => {
|
||||
const ref = useRef<SelectHandle>(null);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user