Native Select

Habillage stylise autour de l'element select natif. Installez Native Select depuis le registre VLLNT UI avec la CLI shadcn.

Signaler un bug

Habillage stylise autour de l'element select natif. Fait partie de la famille form dans VLLNT UI, il est publie comme entree de registre lisible par machine — copiez la source directement dans votre application avec la CLI shadcn et possedez-la, sans dependance d'execution a une bibliotheque de composants.

Apercu

Basculez entre clair et sombre pour inspecter l'apercu Storybook integre.

Installation

Ajoutez Native Select a votre projet avec la CLI shadcn. La source arrive dans votre code, prete a etre adaptee :

pnpm dlx shadcn@latest add https://ui.vllnt.ai/r/native-select.json

Source

import * as React from "react"; import { ChevronDown } from "lucide-react"; import { cn } from "../../lib/utils"; /** Styled wrapper around the native `select` element with a chevron. */ export type NativeSelectProps = React.ComponentPropsWithoutRef<"select"> & { rootClassName?: string; }; const NativeSelect = ({ children, className, ref, rootClassName, ...props }: NativeSelectProps & { ref?: React.Ref<HTMLSelectElement> }) => ( <div className={cn("relative w-full", rootClassName)}> <select {...props} className={cn( "h-10 w-full appearance-none rounded-md border border-input bg-background py-2 pl-3 pr-8 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", className, )} ref={ref} > {children} </select> <ChevronDown className="pointer-events-none absolute right-3 top-1/2 size-4 -translate-y-1/2 opacity-50" /> </div> ); NativeSelect.displayName = "NativeSelect"; export { NativeSelect };

Stories

Explorez chaque variante et etat dans le Storybook interactif :

Apercu

Basculez entre clair et sombre pour inspecter l'apercu Storybook integre.

Dependances

  • @vllnt/ui@^0.3.0