-
- Button active ({{ active }})
+
+ Button raw
-
- Button disabled ({{ active }})
+
+
+ Button active
-
- Link ({{ active }})
+
+ Button active with class
-
- Link disabled ({{ active }})
+
+ Button active disabled
-
- Modal ({{ active }})
+
+
+ Button inactive
+
+
+ Button inactive with class
+
+
+ Button inactive disabled
+
+
+
+ Link raw
+
+
+
+ Link active
+
+
+ Link active with class
+
+
+ Link active disabled
+
+
+
+ Link inactive
+
+
+ Link inactive with class
+
+
+ Link inactive disabled
diff --git a/src/runtime/components/Button.vue b/src/runtime/components/Button.vue
index ce6685d8..8bca71fa 100644
--- a/src/runtime/components/Button.vue
+++ b/src/runtime/components/Button.vue
@@ -60,7 +60,7 @@ const ui = computed(() => tv({ extend: button, slots: props.ui })({
-
+
diff --git a/src/runtime/components/Link.vue b/src/runtime/components/Link.vue
index 90dd39e4..9885dc99 100644
--- a/src/runtime/components/Link.vue
+++ b/src/runtime/components/Link.vue
@@ -1,8 +1,16 @@
diff --git a/src/templates.ts b/src/templates.ts
index cfae8ac9..69db9a67 100644
--- a/src/templates.ts
+++ b/src/templates.ts
@@ -12,10 +12,6 @@ export default function createTemplates (options: ModuleOptions, nuxt: Nuxt) {
getContents: () => `@import "tailwindcss";
@layer base {
- a:focus-visible {
- outline-color: var(--color-primary-500);
- }
-
:root {
color-scheme: light dark;
}
diff --git a/src/theme/index.ts b/src/theme/index.ts
index aa52642e..4423ed29 100644
--- a/src/theme/index.ts
+++ b/src/theme/index.ts
@@ -11,6 +11,7 @@ export { default as formField } from './formField'
export { default as icons } from './icons'
export { default as input } from './input'
export { default as kbd } from './kbd'
+export { default as link } from './link'
export { default as modal } from './modal'
export { default as navigationMenu } from './navigationMenu'
export { default as popover } from './popover'
diff --git a/src/theme/link.ts b/src/theme/link.ts
new file mode 100644
index 00000000..25255262
--- /dev/null
+++ b/src/theme/link.ts
@@ -0,0 +1,12 @@
+export default {
+ base: 'focus-visible:outline-primary-500 dark:focus-visible:outline-primary-400',
+ variants: {
+ active: {
+ true: 'text-primary-500 dark:text-primary-400',
+ false: 'text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200'
+ },
+ disabled: {
+ true: 'cursor-not-allowed opacity-75'
+ }
+ }
+}
diff --git a/test/components/Link.spec.ts b/test/components/Link.spec.ts
index d79eca95..c50218fa 100644
--- a/test/components/Link.spec.ts
+++ b/test/components/Link.spec.ts
@@ -8,8 +8,10 @@ describe('Link', () => {
['with to', { props: { to: '/' } }],
['with type', { props: { type: 'submit' as const } }],
['with disabled', { props: { disabled: true } }],
- ['with activeClass', { props: { active: true, to: '/', activeClass: 'text-sm' } }],
- ['with inactiveClass', { props: { active: false, to: '/', inactiveClass: 'text-gray-300' } }]
+ ['with raw', { props: { raw: true } }],
+ ['with class', { props: { class: 'font-medium' } }],
+ ['with activeClass', { props: { active: true, activeClass: 'text-gray-900 dark:text-white' } }],
+ ['with inactiveClass', { props: { active: false, inactiveClass: 'hover:text-primary-500 dark:hover:text-primary-400' } }]
])('renders %s correctly', async (nameOrHtml: string, options: { props: LinkProps }) => {
const html = await ComponentRender(nameOrHtml, options, Link)
expect(html).toMatchSnapshot()
diff --git a/test/components/__snapshots__/Link.spec.ts.snap b/test/components/__snapshots__/Link.spec.ts.snap
index 7c361b6f..e104bce3 100644
--- a/test/components/__snapshots__/Link.spec.ts.snap
+++ b/test/components/__snapshots__/Link.spec.ts.snap
@@ -1,13 +1,17 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
-exports[`Link > renders with activeClass correctly 1`] = `""`;
+exports[`Link > renders with activeClass correctly 1`] = `""`;
-exports[`Link > renders with as correctly 1`] = `""`;
+exports[`Link > renders with as correctly 1`] = `""`;
-exports[`Link > renders with disabled correctly 1`] = `""`;
+exports[`Link > renders with class correctly 1`] = `""`;
-exports[`Link > renders with inactiveClass correctly 1`] = `""`;
+exports[`Link > renders with disabled correctly 1`] = `""`;
-exports[`Link > renders with to correctly 1`] = `""`;
+exports[`Link > renders with inactiveClass correctly 1`] = `""`;
-exports[`Link > renders with type correctly 1`] = `""`;
+exports[`Link > renders with raw correctly 1`] = `""`;
+
+exports[`Link > renders with to correctly 1`] = `""`;
+
+exports[`Link > renders with type correctly 1`] = `""`;