kbd.tsx 842 B

1234567891011121314151617181920212223242526
  1. import { cn } from '@/lib/utils';
  2. function Kbd({ className, ...props }: React.ComponentProps<'kbd'>) {
  3. return (
  4. <kbd
  5. data-slot="kbd"
  6. className={cn(
  7. "bg-muted text-muted-foreground in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 h-5 w-fit min-w-5 gap-1 rounded-sm px-1 font-sans text-xs font-medium [&_svg:not([class*='size-'])]:size-3 pointer-events-none inline-flex items-center justify-center select-none",
  8. className,
  9. )}
  10. {...props}
  11. />
  12. );
  13. }
  14. function KbdGroup({ className, ...props }: React.ComponentProps<'div'>) {
  15. return (
  16. <kbd
  17. data-slot="kbd-group"
  18. className={cn('gap-1 inline-flex items-center', className)}
  19. {...props}
  20. />
  21. );
  22. }
  23. export { Kbd, KbdGroup };