diff --git a/docs/content/docs/2.components/page-card.md b/docs/content/docs/2.components/page-card.md index 0a8f700947..2160691329 100644 --- a/docs/content/docs/2.components/page-card.md +++ b/docs/content/docs/2.components/page-card.md @@ -188,6 +188,35 @@ slots: :img{src="/tailwindcss-v4.svg" alt="Tailwind CSS" class="w-full"} :: +### Links + +Use the `links` prop to display a list of [Button](/docs/components/button) under the description. + +::component-code{slug="page-Card"} +--- +prettier: true +hide: + - class +ignore: + - title + - description + - icon + - orientation + - links +props: + title: 'Tailwind CSS' + description: 'Nuxt UI integrates with latest Tailwind CSS v4, bringing significant improvements.' + icon: 'i-simple-icons-tailwindcss' + links: + - label: 'Get started' + color: 'neutral' + - label: 'Learn more' + color: 'neutral' + variant: 'subtle' + trailingIcon: 'i-lucide-arrow-right' +--- +:: + ### Highlight Use the `highlight` and `highlight-color` props to display a highlighted border around the card. diff --git a/src/runtime/components/PageCard.vue b/src/runtime/components/PageCard.vue index 5640a8a891..7692c3856e 100644 --- a/src/runtime/components/PageCard.vue +++ b/src/runtime/components/PageCard.vue @@ -1,7 +1,7 @@ @@ -132,18 +134,17 @@ const ariaLabel = computed(() => {
-
+
-
- - - -
-
+
+ + + +
@@ -159,6 +160,12 @@ const ariaLabel = computed(() => {
+
+ + + +
+
@@ -167,13 +174,7 @@ const ariaLabel = computed(() => {
- + diff --git a/src/theme/page-card.ts b/src/theme/page-card.ts index da72414877..5063961686 100644 --- a/src/theme/page-card.ts +++ b/src/theme/page-card.ts @@ -5,22 +5,27 @@ export default (options: Required) => ({ root: 'relative flex rounded-lg', spotlight: 'absolute inset-0 rounded-[inherit] pointer-events-none bg-default/90', container: 'relative flex flex-col flex-1 lg:grid gap-x-8 gap-y-4 p-4 sm:p-6', - wrapper: 'flex flex-col flex-1 items-start', + wrapper: 'flex flex-col flex-1 items-start gap-2.5 flex-wrap', header: 'mb-4', body: 'flex-1', footer: 'pt-4 mt-auto', leading: 'inline-flex items-center mb-2.5', leadingIcon: 'size-5 shrink-0 text-primary', title: 'text-base text-pretty font-semibold text-highlighted', - description: 'text-[15px] text-pretty' + description: 'text-[15px] text-pretty', + links: 'inline-flex flex-wrap gap-2.5' }, variants: { orientation: { horizontal: { - container: 'lg:grid-cols-2 lg:items-center' + container: 'lg:grid-cols-2 lg:items-center', + wrapper: '', + links: '' }, vertical: { - container: '' + container: '', + wrapper: 'flex-row', + links: 'self-center' } }, reverse: { diff --git a/test/components/PageCard.spec.ts b/test/components/PageCard.spec.ts index 4cc4fd2a8a..ec4905ac5c 100644 --- a/test/components/PageCard.spec.ts +++ b/test/components/PageCard.spec.ts @@ -22,6 +22,7 @@ describe('PageCard', () => { ['with icon', { props: { icon: 'i-lucide-house' } }], ['with title', { props: { title: 'Title' } }], ['with description', { props: { description: 'Description' } }], + ['with links', { props: { links: [{ label: 'Get started' }] } }], ['with to', { props: { to: 'https://github.com/benjamincanac' } }], ...variants.map((variant: string) => [`with variant ${variant}`, { props: { ...props, variant } }]), ...variants.map((variant: string) => [`with variant ${variant} to`, { props: { ...props, variant, to: 'https://github.com/benjamincanac' } }]), @@ -43,6 +44,7 @@ describe('PageCard', () => { ['with title slot', { props, slots: { title: () => 'Title slot' } }], ['with description slot', { props, slots: { description: () => 'Description slot' } }], ['with footer slot', { props, slots: { footer: () => 'Footer slot' } }], + ['with links slot', { props, slots: { links: () => 'Links slot' } }], ['with default slot', { props, slots: { default: () => 'Default slot' } }] ])('renders %s correctly', async (nameOrHtml: string, options: { props?: PageCardProps, slots?: Partial }) => { const html = await ComponentRender(nameOrHtml, options, PageCard) diff --git a/test/components/__snapshots__/PageCard-vue.spec.ts.snap b/test/components/__snapshots__/PageCard-vue.spec.ts.snap index dd730f7cd4..7c63799259 100644 --- a/test/components/__snapshots__/PageCard-vue.spec.ts.snap +++ b/test/components/__snapshots__/PageCard-vue.spec.ts.snap @@ -14,10 +14,12 @@ exports[`PageCard > renders with body slot correctly 1`] = ` "
-
+
+ +
+
Body slot +
-
-
Body slot
@@ -29,14 +31,15 @@ exports[`PageCard > renders with class correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -47,14 +50,15 @@ exports[`PageCard > renders with default slot correctly 1`] = ` "
-
+
-
+
Title
Description
+
Default slot
@@ -65,14 +69,15 @@ exports[`PageCard > renders with description correctly 1`] = ` "
-
- +
+
Description
+
@@ -83,14 +88,15 @@ exports[`PageCard > renders with description slot correctly 1`] = ` "
-
+
-
+
Title
Description slot
+
@@ -101,13 +107,14 @@ exports[`PageCard > renders with footer slot correctly 1`] = ` "
-
+
-
+
Title
Description
+
Footer slot
@@ -119,14 +126,15 @@ exports[`PageCard > renders with header slot correctly 1`] = ` "
-
+
Header slot
-
+
Title
Description
+
@@ -137,14 +145,15 @@ exports[`PageCard > renders with highlight color error correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -155,14 +164,15 @@ exports[`PageCard > renders with highlight color info correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -173,14 +183,15 @@ exports[`PageCard > renders with highlight color neutral correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -191,14 +202,15 @@ exports[`PageCard > renders with highlight color neutral correctly 2`] = ` "
-
+
-
+
Title
Description
+
@@ -209,14 +221,15 @@ exports[`PageCard > renders with highlight color primary correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -227,14 +240,15 @@ exports[`PageCard > renders with highlight color secondary correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -245,14 +259,15 @@ exports[`PageCard > renders with highlight color success correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -263,14 +278,15 @@ exports[`PageCard > renders with highlight color warning correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -281,14 +297,15 @@ exports[`PageCard > renders with highlight correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -299,9 +316,9 @@ exports[`PageCard > renders with icon correctly 1`] = ` "
-
+
+ -
@@ -314,14 +331,52 @@ exports[`PageCard > renders with leading slot correctly 1`] = ` "
-
+
-
Leading slot
+
Leading slot
Title
Description
+ +
+
+ +
" +`; + +exports[`PageCard > renders with links correctly 1`] = ` +"
+ +
+
+ + +
+ +
+
+ +
" +`; + +exports[`PageCard > renders with links slot correctly 1`] = ` +"
+ +
+
+ +
+
+
Title
+
Description
+
+
Links slot
+
@@ -332,14 +387,15 @@ exports[`PageCard > renders with orientation horizontal correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -350,14 +406,15 @@ exports[`PageCard > renders with orientation horizontal reverse correctly 1`] = "
-
+
-
+
Title
Description
+
@@ -368,14 +425,15 @@ exports[`PageCard > renders with orientation vertical correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -386,14 +444,15 @@ exports[`PageCard > renders with orientation vertical reverse correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -404,14 +463,15 @@ exports[`PageCard > renders with spotlight color error correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -422,14 +482,15 @@ exports[`PageCard > renders with spotlight color info correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -440,14 +501,15 @@ exports[`PageCard > renders with spotlight color neutral correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -458,14 +520,15 @@ exports[`PageCard > renders with spotlight color neutral correctly 2`] = ` "
-
+
-
+
Title
Description
+
@@ -476,14 +539,15 @@ exports[`PageCard > renders with spotlight color primary correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -494,14 +558,15 @@ exports[`PageCard > renders with spotlight color secondary correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -512,14 +577,15 @@ exports[`PageCard > renders with spotlight color success correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -530,14 +596,15 @@ exports[`PageCard > renders with spotlight color warning correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -548,14 +615,15 @@ exports[`PageCard > renders with spotlight correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -566,14 +634,15 @@ exports[`PageCard > renders with title correctly 1`] = ` "
-
- +
+
Title
+
@@ -584,14 +653,15 @@ exports[`PageCard > renders with title slot correctly 1`] = ` "
-
+
-
+
Title slot
Description
+
@@ -611,14 +681,15 @@ exports[`PageCard > renders with ui correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -629,14 +700,15 @@ exports[`PageCard > renders with variant ghost correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -647,14 +719,15 @@ exports[`PageCard > renders with variant ghost highlight correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -665,14 +738,15 @@ exports[`PageCard > renders with variant ghost to correctly 1`] = ` "
-
+
-
+
Title
Description
+
" @@ -682,14 +756,15 @@ exports[`PageCard > renders with variant naked correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -700,14 +775,15 @@ exports[`PageCard > renders with variant naked highlight correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -718,14 +794,15 @@ exports[`PageCard > renders with variant naked to correctly 1`] = ` "
-
+
-
+
Title
Description
+
" @@ -735,14 +812,15 @@ exports[`PageCard > renders with variant outline correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -753,14 +831,15 @@ exports[`PageCard > renders with variant outline highlight correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -771,14 +850,15 @@ exports[`PageCard > renders with variant outline to correctly 1`] = ` "
-
+
-
+
Title
Description
+
" @@ -788,14 +868,15 @@ exports[`PageCard > renders with variant soft correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -806,14 +887,15 @@ exports[`PageCard > renders with variant soft highlight correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -824,14 +906,15 @@ exports[`PageCard > renders with variant soft to correctly 1`] = ` "
-
+
-
+
Title
Description
+
" @@ -841,14 +924,15 @@ exports[`PageCard > renders with variant solid correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -859,14 +943,15 @@ exports[`PageCard > renders with variant solid highlight correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -877,14 +962,15 @@ exports[`PageCard > renders with variant solid to correctly 1`] = ` "
-
+
-
+
Title
Description
+
" @@ -894,14 +980,15 @@ exports[`PageCard > renders with variant subtle correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -912,14 +999,15 @@ exports[`PageCard > renders with variant subtle highlight correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -930,14 +1018,15 @@ exports[`PageCard > renders with variant subtle to correctly 1`] = ` "
-
+
-
+
Title
Description
+
" diff --git a/test/components/__snapshots__/PageCard.spec.ts.snap b/test/components/__snapshots__/PageCard.spec.ts.snap index 294af1ae60..082f53b657 100644 --- a/test/components/__snapshots__/PageCard.spec.ts.snap +++ b/test/components/__snapshots__/PageCard.spec.ts.snap @@ -14,10 +14,12 @@ exports[`PageCard > renders with body slot correctly 1`] = ` "
-
+
+ +
+
Body slot +
-
-
Body slot
@@ -29,14 +31,15 @@ exports[`PageCard > renders with class correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -47,14 +50,15 @@ exports[`PageCard > renders with default slot correctly 1`] = ` "
-
+
-
+
Title
Description
+
Default slot
@@ -65,14 +69,15 @@ exports[`PageCard > renders with description correctly 1`] = ` "
-
- +
+
Description
+
@@ -83,14 +88,15 @@ exports[`PageCard > renders with description slot correctly 1`] = ` "
-
+
-
+
Title
Description slot
+
@@ -101,13 +107,14 @@ exports[`PageCard > renders with footer slot correctly 1`] = ` "
-
+
-
+
Title
Description
+
Footer slot
@@ -119,14 +126,15 @@ exports[`PageCard > renders with header slot correctly 1`] = ` "
-
+
Header slot
-
+
Title
Description
+
@@ -137,14 +145,15 @@ exports[`PageCard > renders with highlight color error correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -155,14 +164,15 @@ exports[`PageCard > renders with highlight color info correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -173,14 +183,15 @@ exports[`PageCard > renders with highlight color neutral correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -191,14 +202,15 @@ exports[`PageCard > renders with highlight color neutral correctly 2`] = ` "
-
+
-
+
Title
Description
+
@@ -209,14 +221,15 @@ exports[`PageCard > renders with highlight color primary correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -227,14 +240,15 @@ exports[`PageCard > renders with highlight color secondary correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -245,14 +259,15 @@ exports[`PageCard > renders with highlight color success correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -263,14 +278,15 @@ exports[`PageCard > renders with highlight color warning correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -281,14 +297,15 @@ exports[`PageCard > renders with highlight correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -299,9 +316,9 @@ exports[`PageCard > renders with icon correctly 1`] = ` "
-
+
+ -
@@ -314,14 +331,52 @@ exports[`PageCard > renders with leading slot correctly 1`] = ` "
-
+
-
Leading slot
+
Leading slot
Title
Description
+ +
+
+ +
" +`; + +exports[`PageCard > renders with links correctly 1`] = ` +"
+ +
+
+ + +
+ +
+
+ +
" +`; + +exports[`PageCard > renders with links slot correctly 1`] = ` +"
+ +
+
+ +
+
+
Title
+
Description
+
+
Links slot
+
@@ -332,14 +387,15 @@ exports[`PageCard > renders with orientation horizontal correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -350,14 +406,15 @@ exports[`PageCard > renders with orientation horizontal reverse correctly 1`] = "
-
+
-
+
Title
Description
+
@@ -368,14 +425,15 @@ exports[`PageCard > renders with orientation vertical correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -386,14 +444,15 @@ exports[`PageCard > renders with orientation vertical reverse correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -404,14 +463,15 @@ exports[`PageCard > renders with spotlight color error correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -422,14 +482,15 @@ exports[`PageCard > renders with spotlight color info correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -440,14 +501,15 @@ exports[`PageCard > renders with spotlight color neutral correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -458,14 +520,15 @@ exports[`PageCard > renders with spotlight color neutral correctly 2`] = ` "
-
+
-
+
Title
Description
+
@@ -476,14 +539,15 @@ exports[`PageCard > renders with spotlight color primary correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -494,14 +558,15 @@ exports[`PageCard > renders with spotlight color secondary correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -512,14 +577,15 @@ exports[`PageCard > renders with spotlight color success correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -530,14 +596,15 @@ exports[`PageCard > renders with spotlight color warning correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -548,14 +615,15 @@ exports[`PageCard > renders with spotlight correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -566,14 +634,15 @@ exports[`PageCard > renders with title correctly 1`] = ` "
-
- +
+
Title
+
@@ -584,14 +653,15 @@ exports[`PageCard > renders with title slot correctly 1`] = ` "
-
+
-
+
Title slot
Description
+
@@ -611,14 +681,15 @@ exports[`PageCard > renders with ui correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -629,14 +700,15 @@ exports[`PageCard > renders with variant ghost correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -647,14 +719,15 @@ exports[`PageCard > renders with variant ghost highlight correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -665,14 +738,15 @@ exports[`PageCard > renders with variant ghost to correctly 1`] = ` "
-
+
-
+
Title
Description
+
" @@ -682,14 +756,15 @@ exports[`PageCard > renders with variant naked correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -700,14 +775,15 @@ exports[`PageCard > renders with variant naked highlight correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -718,14 +794,15 @@ exports[`PageCard > renders with variant naked to correctly 1`] = ` "
-
+
-
+
Title
Description
+
" @@ -735,14 +812,15 @@ exports[`PageCard > renders with variant outline correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -753,14 +831,15 @@ exports[`PageCard > renders with variant outline highlight correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -771,14 +850,15 @@ exports[`PageCard > renders with variant outline to correctly 1`] = ` "
-
+
-
+
Title
Description
+
" @@ -788,14 +868,15 @@ exports[`PageCard > renders with variant soft correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -806,14 +887,15 @@ exports[`PageCard > renders with variant soft highlight correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -824,14 +906,15 @@ exports[`PageCard > renders with variant soft to correctly 1`] = ` "
-
+
-
+
Title
Description
+
" @@ -841,14 +924,15 @@ exports[`PageCard > renders with variant solid correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -859,14 +943,15 @@ exports[`PageCard > renders with variant solid highlight correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -877,14 +962,15 @@ exports[`PageCard > renders with variant solid to correctly 1`] = ` "
-
+
-
+
Title
Description
+
" @@ -894,14 +980,15 @@ exports[`PageCard > renders with variant subtle correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -912,14 +999,15 @@ exports[`PageCard > renders with variant subtle highlight correctly 1`] = ` "
-
+
-
+
Title
Description
+
@@ -930,14 +1018,15 @@ exports[`PageCard > renders with variant subtle to correctly 1`] = ` "
-
+
-
+
Title
Description
+
"