mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
* chore(root): menu and select components in progress * chore(root): merged with main * feat(menu): stories created * feat(dropdown): menu migrated to menu component * feat(select): base implementation in progress * feat(select): listbox implemented * feat(select): scroll overflow and auto scroll added * feat(select): colors & variants improved, inside placement complete, outside pending * feat(scroll-shadow): new component in progress * feat(select): scroll shadow integrated * fix(select): popover implementation, more scroll shadow stories added * feat(listbox): custom styles example added to stories * chore(listbox): overflow hidden removed * feat(select): variants and styles completed * chore(select): description story added * feat(select): more stories added * fix(select): dynamic collections inference, styles improved, more stories added * fix(select): auto scroll to selected item, scroll padding added * chore(select): scroll behavior changed to nearest * feat(select): custom item story added * fix(select): autoscroll fixed * feat(select): multi select support added * feat(select): more examples added, clean-package modified to remove dev packages * chore(modal): useImperativeHandle removed * feat(select): render value story improved * feat(docs): listbox & scroll shadow docs done * feat(docs): select documentation in progress * fix: select aria label (#1425) * feat(docs): more examples added * feat(docs): select multiple added, storybook favicon changed * fix: added value to aria label of select (#1431) * feat(select): more examples added, storybook favicon changed * fix(popover): dialog role removed * feat(select): api added, async loading exampled added * fix: fixed list box on click not working with sr click (#1439) * feat(select): async items loading support added and documented * feat(root): input styles updated to be as the select ones * chore(root): listbox and scroll shadow readme updated * feat(select): ts examples added, banner updated * fix(popover): voiceover closes when focusing an item fixed * chore(select): focus scope removed * fix(popover): free solo popover added to use without a trigger * feat(select): blog post added * chore(docs): search meta generated, multi controlled onchange example fixed * chore(root): changeset added --------- Co-authored-by: Jakob Guddas <github@jguddas.de>
90 lines
3.0 KiB
TypeScript
90 lines
3.0 KiB
TypeScript
const data = `export const animals = [
|
|
{label: "Cat", value: "cat", description: "The second most popular pet in the world"},
|
|
{label: "Dog", value: "dog", description: "The most popular pet in the world"},
|
|
{label: "Elephant", value: "elephant", description: "The largest land animal"},
|
|
{label: "Lion", value: "lion", description: "The king of the jungle"},
|
|
{label: "Tiger", value: "tiger", description: "The largest cat species"},
|
|
{label: "Giraffe", value: "giraffe", description: "The tallest land animal"},
|
|
{
|
|
label: "Dolphin",
|
|
value: "dolphin",
|
|
description: "A widely distributed and diverse group of aquatic mammals",
|
|
},
|
|
{label: "Penguin", value: "penguin", description: "A group of aquatic flightless birds"},
|
|
{label: "Zebra", value: "zebra", description: "A several species of African equids"},
|
|
{
|
|
label: "Shark",
|
|
value: "shark",
|
|
description: "A group of elasmobranch fish characterized by a cartilaginous skeleton",
|
|
},
|
|
{
|
|
label: "Whale",
|
|
value: "whale",
|
|
description: "Diverse group of fully aquatic placental marine mammals",
|
|
},
|
|
{label: "Otter", value: "otter", description: "A carnivorous mammal in the subfamily Lutrinae"},
|
|
{label: "Crocodile", value: "crocodile", description: "A large semiaquatic reptile"},
|
|
];`;
|
|
|
|
const App = `import {Select, SelectItem} from "@nextui-org/react";
|
|
import {animals} from "./data";
|
|
|
|
export default function App() {
|
|
const placements = [
|
|
"inside",
|
|
"outside",
|
|
"outside-left",
|
|
];
|
|
|
|
return (
|
|
<div className="w-full flex flex-col gap-4">
|
|
<div className="flex flex-col gap-2">
|
|
<h3 className="text-default-500 text-small">Without placeholder</h3>
|
|
<div className="flex w-full flex-wrap items-end md:flex-nowrap mb-6 md:mb-0 gap-4">
|
|
{placements.map((placement) => (
|
|
<Select
|
|
labelPlacement={placement}
|
|
label="Favorite Animal"
|
|
className="max-w-xs"
|
|
>
|
|
{animals.map((animal) => (
|
|
<SelectItem key={animal.value} value={animal.value}>
|
|
{animal.label}
|
|
</SelectItem>
|
|
))}
|
|
</Select>
|
|
))}
|
|
</div>
|
|
</div>
|
|
<div className="flex flex-col gap-2">
|
|
<h3 className="text-default-500 text-small">With placeholder</h3>
|
|
<div className="flex w-full flex-wrap items-end md:flex-nowrap mb-6 md:mb-0 gap-4">
|
|
{placements.map((placement) => (
|
|
<Select
|
|
labelPlacement={placement}
|
|
label="Favorite Animal"
|
|
placeholder="Select an animal"
|
|
className="max-w-xs"
|
|
>
|
|
{animals.map((animal) => (
|
|
<SelectItem key={animal.value} value={animal.value}>
|
|
{animal.label}
|
|
</SelectItem>
|
|
))}
|
|
</Select>
|
|
))}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}`;
|
|
|
|
const react = {
|
|
"/App.jsx": App,
|
|
"/data.js": data,
|
|
};
|
|
|
|
export default {
|
|
...react,
|
|
};
|