Kbd.tsx 664 B

1234567891011121314151617181920
  1. // Copy Pasta from: https://github.com/sadmann7/shadcn-table/blob/main/src/components/kbd.tsx#L54
  2. import { ComponentPropsWithoutRef, forwardRef } from 'react'
  3. import { cn } from 'ui'
  4. export const kdbClassName = cn(
  5. 'select-none rounded-sm border px-1.5 py-px font-mono text-[0.7rem] font-normal font-mono shadow-xs disabled:opacity-50',
  6. 'bg-background text-foreground'
  7. )
  8. export const Kbd = forwardRef<HTMLUnknownElement, ComponentPropsWithoutRef<'kbd'>>(
  9. ({ children, className, ...props }, ref) => {
  10. return (
  11. <kbd className={cn(kdbClassName, className)} ref={ref} {...props}>
  12. {children}
  13. </kbd>
  14. )
  15. }
  16. )
  17. Kbd.displayName = 'Kbd'