Multi Select 1Lyra
pixelflow-ui/multi-select-1-lyraFreeComponent
pixelflow-ui publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by pixelflow-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://pixelflowui.lok1.dev/r/multi-select-1-lyra.jsonSource
1"use client";23import * as React from "react";4import { cva } from "class-variance-authority";5import { CheckIcon, XCircle, ChevronDown, XIcon } from "lucide-react";67import { cn } from "@/lib/utils";8import { Button } from "@/components/ui/button";9import { Badge } from "@/components/ui/badge";10import {11 Popover,12 PopoverContent,13 PopoverTrigger,14} from "@/components/ui/popover";15import {16 Command,17 CommandEmpty,18 CommandGroup,19 CommandItem,20 CommandList,21 CommandSeparator,22} from "@/components/ui/command";2324const multiSelectVariants = cva(25 "m-1 transition ease-in-out duration-300 font-monouppercase tracking-wider rounded-none",26 {27 variants: {28 variant: {29 default:30 "border-[0.6px] border-white/20 text-white bg-neutral-900 hover:bg-neutral-800",31 secondary:32 "border-white/20 bg-neutral-800 text-white hover:bg-neutral-700",33 destructive:34 "border-transparent bg-red-900 text-white hover:bg-red-800",35 inverted: "inverted",36 },37 },38 defaultVariants: {39 variant: "default",40 },41 }42);4344export const MultiSelect = React.forwardRef(45 (46 {47 options,48 value,49 variant,50 placeholder = "SELECT OPTIONS",51 modalPopover = false,52 asChild = false,53 className,54 wrap = true,55 maxHeight = 200,56 ...props57 },58 ref59 ) => {60 const [selectedValues, setSelectedValues] = React.useState(value ?? []);61 const [maxCount, setMaxCount] = React.useState(null);62 const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);63 const triggerRef = React.useRef(null);64 const [triggerWidth, setTriggerWidth] = React.useState(0);65 const optionsRefs = React.useRef([]);66 const [lineBreak, setLineBreak] = React.useState(true);67 const badgeRef = React.useRef(null);68 const crossRef = React.useRef(null);6970 const areAllSelected = options.every((opt) =>71 selectedValues.includes(opt.value)72 );7374 const handleSelectAll = () => {75 const allValues = options.map((opt) => opt.value);76 const currentlyAllSelected = options.every((opt) =>77 selectedValues.includes(opt.value)78 );7980 const newSelectedValues = currentlyAllSelected ? [] : allValues;81 setSelectedValues(newSelectedValues);82 };8384 React.useEffect(() => {85 if (isPopoverOpen && triggerRef.current) {86 setTriggerWidth(triggerRef.current.offsetWidth);87 }88 }, [isPopoverOpen]);8990// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from pixelflow-ui
All 35 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordion Lyraaccordion-lyra | pixelflow-ui | Components | Free | 3 deps | |
| Accordion Novaaccordion-nova | pixelflow-ui | Components | Free | 3 deps | |
| Accordion Retroaccordion-retro | pixelflow-ui | Components | Free | 3 deps | |
| Background 1background-1 | pixelflow-ui | Components | Free | no deps | |
| Background 1Retrobackground-1-retro | pixelflow-ui | Components | Free | no deps | |
| Bouncy Input Lyrabouncy-input-lyra | pixelflow-ui | Components | Free | 1 dep | |
| Bouncy Input Novabouncy-input-nova | pixelflow-ui | Components | Free | 1 dep | |
| Bouncy Input Retrobouncy-input-retro | pixelflow-ui | Components | Free | 1 dep |
