-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/runtime/components/Kbd.vue b/src/runtime/components/Kbd.vue
index 6da5d5f0..b3221ba7 100644
--- a/src/runtime/components/Kbd.vue
+++ b/src/runtime/components/Kbd.vue
@@ -13,6 +13,7 @@ type KbdVariants = VariantProps
export interface KbdProps extends Omit {
value?: string
+ color?: KbdVariants['color']
size?: KbdVariants['size']
class?: any
}
@@ -30,7 +31,7 @@ defineSlots()
-
+
{{ value }}
diff --git a/src/theme/kbd.ts b/src/theme/kbd.ts
index 706a379e..a366bda0 100644
--- a/src/theme/kbd.ts
+++ b/src/theme/kbd.ts
@@ -1,6 +1,11 @@
export default {
- base: 'inline-flex items-center justify-center text-gray-900 dark:text-white px-1 rounded font-medium font-sans bg-gray-50 dark:bg-gray-800 ring ring-gray-300 dark:ring-gray-700 ring-inset',
+ base: 'inline-flex items-center justify-center px-1 rounded font-medium font-sans',
variants: {
+ color: {
+ white: 'bg-white dark:bg-gray-900 text-gray-900 dark:text-white ring ring-inset ring-gray-300 dark:ring-gray-700',
+ gray: 'bg-gray-50 dark:bg-gray-800 text-gray-700 dark:text-gray-200 ring ring-inset ring-gray-300 dark:ring-gray-700',
+ black: 'bg-gray-900 dark:bg-white text-white dark:text-gray-900'
+ },
size: {
xs: 'h-4 min-w-[16px] text-[10px]',
sm: 'h-5 min-w-[20px] text-[11px]',
@@ -8,6 +13,7 @@ export default {
}
},
defaultVariants: {
+ color: 'white',
size: 'sm'
}
}
diff --git a/test/components/Kbd.spec.ts b/test/components/Kbd.spec.ts
index 6487db9d..c3c714d6 100644
--- a/test/components/Kbd.spec.ts
+++ b/test/components/Kbd.spec.ts
@@ -10,6 +10,9 @@ describe('Kbd', () => {
['with size xs', { props: { value: 'K', size: 'xs' as const } }],
['with size sm', { props: { value: 'K', size: 'sm' as const } }],
['with size md', { props: { value: 'K', size: 'md' as const } }],
+ ['with color white', { props: { value: 'K', color: 'white' as const } }],
+ ['with color gray', { props: { value: 'K', color: 'gray' as const } }],
+ ['with color black', { props: { value: 'K', color: 'black' as const } }],
['with default slot', { slots: { default: () => 'Default slot' } }]
])('renders %s correctly', async (nameOrHtml: string, options: { props?: KbdProps, slots?: any }) => {
const html = await ComponentRender(nameOrHtml, options, Kbd)
diff --git a/test/components/__snapshots__/Kbd.spec.ts.snap b/test/components/__snapshots__/Kbd.spec.ts.snap
index 2eaca1dd..c11b26a4 100644
--- a/test/components/__snapshots__/Kbd.spec.ts.snap
+++ b/test/components/__snapshots__/Kbd.spec.ts.snap
@@ -1,15 +1,21 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
-exports[`Kbd > renders with as correctly 1`] = `"K"`;
+exports[`Kbd > renders with as correctly 1`] = `"K"`;
-exports[`Kbd > renders with class correctly 1`] = `"K"`;
+exports[`Kbd > renders with class correctly 1`] = `"K"`;
-exports[`Kbd > renders with default slot correctly 1`] = `"Default slot"`;
+exports[`Kbd > renders with color black correctly 1`] = `"K"`;
-exports[`Kbd > renders with size md correctly 1`] = `"K"`;
+exports[`Kbd > renders with color gray correctly 1`] = `"K"`;
-exports[`Kbd > renders with size sm correctly 1`] = `"K"`;
+exports[`Kbd > renders with color white correctly 1`] = `"K"`;
-exports[`Kbd > renders with size xs correctly 1`] = `"K"`;
+exports[`Kbd > renders with default slot correctly 1`] = `"Default slot"`;
-exports[`Kbd > renders with value correctly 1`] = `"K"`;
+exports[`Kbd > renders with size md correctly 1`] = `"K"`;
+
+exports[`Kbd > renders with size sm correctly 1`] = `"K"`;
+
+exports[`Kbd > renders with size xs correctly 1`] = `"K"`;
+
+exports[`Kbd > renders with value correctly 1`] = `"K"`;