chip
lyse/chipFreeComponent
lyse publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by lyse on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.getlyse.com/r/chip.jsonSource
1import * as React from "react"2import { cva, type VariantProps } from "class-variance-authority"3import { ChevronDown } from "lucide-react"45import { cn } from "@/lib/utils"6import "./chip.css"78const chipVariants = cva(9 "chip-base inline-flex h-[var(--layout-size-md)] items-center justify-center whitespace-nowrap rounded-[var(--layout-radius-full)] py-[var(--layout-padding-xs)] text-content-caption cursor-pointer [&_svg]:pointer-events-none [&_svg]:shrink-0",10 {11 variants: {12 variant: {13 filled: "chip-filled",14 outline: "chip-outline",15 ghost: "chip-ghost",16 },17 },18 defaultVariants: {19 variant: "filled",20 },21 }22)2324function Chip({25 className,26 variant,27 hasDropdown = false,28 icon,29 children,30 ...props31}: React.ComponentProps<"button"> &32 VariantProps<typeof chipVariants> & {33 hasDropdown?: boolean34 icon?: React.ReactNode35 }) {36 return (37 <button38 data-slot="chip"39 type="button"40 className={cn(41 chipVariants({ variant, className }),42 hasDropdown43 ? "gap-0 pl-[var(--layout-padding-md)] pr-[var(--layout-padding-xs)]"44 : "gap-[var(--layout-gap-xs)] px-[var(--layout-padding-md)]"45 )}46 {...props}47 >48 {!hasDropdown && icon && (49 <span className="chip-icon shrink-0 flex items-center" aria-hidden="true">50 {icon}51 </span>52 )}53 {children}54 {hasDropdown && (55 <ChevronDown className="chip-chevron" aria-hidden="true" />56 )}57 </button>58 )59}6061export { Chip, chipVariants }
What it pulls in
npm packages
Other registry items
Files it writes
More from lyse
All 33 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| action-cardaction-card | lyse | Components | Free | no deps · 2 files | |
| alertalert | lyse | Components | Free | 2 deps · 2 files | |
| alert-dialogalert-dialog | lyse | Components | Free | 2 deps · 2 files | |
| avataravatar | lyse | Components | Free | 3 deps · 2 files | |
| badgebadge | lyse | Components | Free | 1 dep · 2 files | |
| banner-infobanner-info | lyse | Components | Free | 2 deps · 2 files | |
| breadcrumbbreadcrumb | lyse | Components | Free | 2 deps · 2 files | |
| buttonbutton | lyse | Components | Free | 2 deps · 2 files |
