Kbd
Usage
Use the default slot to set the value of the Kbd.
<template>
<PKbd>K</PKbd>
</template>
Value
Use the value prop to set the value of the Kbd.
<template>
<PKbd value="K" />
</template>
You can pass special keys to the value prop that goes through the useKbd composable. For example, the meta key displays as ⌘ on macOS and Ctrl on other platforms.
<template>
<PKbd value="meta" />
</template>
Color
Use the color prop to change the color of the Kbd.
<template>
<PKbd color="neutral">K</PKbd>
</template>
Variant
Use the variant prop to change the variant of the Kbd.
<template>
<PKbd color="neutral" variant="solid">K</PKbd>
</template>
Size
Use the size prop to change the size of the Kbd.
<template>
<PKbd size="lg">K</PKbd>
</template>
Examples
class prop
Use the class prop to override the base styles of the Badge.
<template>
<PKbd class="akar:font-bold akar:rounded-full" variant="subtle">K</PKbd>
</template>
API
Props
| Prop | Default | Type |
|---|---|---|
as | 'kbd' | anyThe element or component this component should render as. |
value | string | |
color | 'neutral' | "primary" | "secondary" | "success" | "info" | "warning" | "error" | "neutral" |
variant | 'outline' | "outline" | "soft" | "subtle" | "solid" |
size | 'md' | "md" | "sm" | "lg" |
Slots
| Slot | Type |
|---|---|
default | object |
Theme
Below is the theme configuration skeleton for the PKbd. Since the component is provided unstyled by default, you will need to fill in these values to apply your own custom look and feel. If you prefer to use our pre-built, opinionated styling, you can instead use our UnoCSS preset, this docs is using it as well.
export default defineAppConfig({
pohon: {
kbd: {
base: '',
variants: {
color: {
primary: '',
secondary: '',
success: '',
info: '',
warning: '',
error: '',
neutral: ''
},
variant: {
solid: '',
outline: '',
soft: '',
subtle: ''
},
size: {
sm: '',
md: '',
lg: ''
}
},
compoundVariants: [],
defaultVariants: {
variant: 'outline',
color: 'neutral',
size: 'md'
}
}
}
};
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import pohon from 'pohon-ui/vite'
export default defineAppConfig({
pohon: {
kbd: {
base: '',
variants: {
color: {
primary: '',
secondary: '',
success: '',
info: '',
warning: '',
error: '',
neutral: ''
},
variant: {
solid: '',
outline: '',
soft: '',
subtle: ''
},
size: {
sm: '',
md: '',
lg: ''
}
},
compoundVariants: [],
defaultVariants: {
variant: 'outline',
color: 'neutral',
size: 'md'
}
}
}
};