Icon
dashboardblocks/iconFreeComponent
An icon component.
Live preview
live · rendered by the registry
Rendered by dashboardblocks on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://dashboardblocks.com/r/icon.jsonSource
1import { type VariantProps, cva } from 'class-variance-authority'2import { type LucideIcon } from 'lucide-react'34import { cn } from '@/lib/utils'56const iconVariants = cva('flex items-center justify-center bg-muted aspect-square', {7 variants: {8 variant: {9 default: 'bg-primary text-primary-foreground hover:bg-primary/90',10 destructive:11 'bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',12 outline:13 'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',14 secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',15 ghost: 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',16 link: 'text-primary underline-offset-4 hover:underline',17 },18 shape: {19 square: 'rounded-md',20 circle: 'rounded-full',21 },22 size: {23 default: 'size-12 p-3',24 sm: 'size-8 p-2',25 md: 'size-10 p-2.5',26 },27 },28 defaultVariants: {29 variant: 'default',30 shape: 'square',31 size: 'default',32 },33})3435interface IconProps extends VariantProps<typeof iconVariants> {36 className?: string37 icon: LucideIcon38}3940function Icon({41 className,42 variant = 'default',43 icon: IconComponent,44 shape = 'square',45 size,46}: IconProps) {47 return (48 <div className={cn(iconVariants({ variant, shape, size }), className)}>49 <IconComponent />50 </div>51 )52}5354type SVGProps = React.HTMLAttributes<SVGElement>5556const Icons = {57 github: (props: SVGProps) => (58 <svg viewBox='0 0 438.549 438.549' {...props}>59 <path60 fill='#1f2328'61// … truncated
What it pulls in
npm packages
Files it writes
More from dashboardblocks
All 36 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Activity Feedactivity-feed | dashboardblocks | Components | Free | 1 dep | |
| activity-feed-01activity-feed-01 | dashboardblocks | Components | Free | 1 dep | |
| activity-feed-02activity-feed-02 | dashboardblocks | Components | Free | 1 dep | |
| activity-feed-03activity-feed-03 | dashboardblocks | Components | Free | 1 dep | |
| activity-feed-04activity-feed-04 | dashboardblocks | Components | Free | 1 dep | |
| activity-feed-05activity-feed-05 | dashboardblocks | Components | Free | 1 dep | |
| Animated Numberanimated-number | dashboardblocks | Components | Free | no deps | |
| Animated Waveanimated-wave | dashboardblocks | Components | Free | no deps |
