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