From c81d203822c2111ee1f91dfd64fc3167e0d195cc Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 7 May 2026 18:45:27 +0000 Subject: [PATCH 1/3] feat(DescriptionList): render description as link via item.to Add optional 'to' (and 'target') fields to DescriptionListItem so consumers can turn a value into a B24Link without registering a custom slot. When 'slot' is set on an item the link wrapping is skipped, so existing custom-rendered items keep their previous behaviour. https://claude.ai/code/session_013gYN6XWQ18LRJdDsatDpf7 --- .../DescriptionListLinkExample.vue | 25 +++++++++++++++ .../docs/2.components/description-list.md | 11 +++++++ .../app/pages/components/description-list.vue | 31 ++++++++++++++++++- .../app/pages/components/description-list.vue | 29 +++++++++++++++++ src/runtime/components/DescriptionList.vue | 18 ++++++++++- 5 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 docs/app/components/content/examples/description-list/DescriptionListLinkExample.vue diff --git a/docs/app/components/content/examples/description-list/DescriptionListLinkExample.vue b/docs/app/components/content/examples/description-list/DescriptionListLinkExample.vue new file mode 100644 index 000000000..72df7a7b3 --- /dev/null +++ b/docs/app/components/content/examples/description-list/DescriptionListLinkExample.vue @@ -0,0 +1,25 @@ + + + diff --git a/docs/content/docs/2.components/description-list.md b/docs/content/docs/2.components/description-list.md index 9d222d249..574cb5c1a 100644 --- a/docs/content/docs/2.components/description-list.md +++ b/docs/content/docs/2.components/description-list.md @@ -231,6 +231,17 @@ name: 'description-list-custom-slot-example' --- :: +### With link in items + +Use the `to` property on an item to render the description as a [Link](/docs/components/link/). Pair it with `target: '_blank'` for external destinations. Items that set their own `slot` are not affected. + +::component-example +--- +collapse: true +name: 'description-list-link-example' +--- +:: + ## API ### Props diff --git a/playgrounds/demo/app/pages/components/description-list.vue b/playgrounds/demo/app/pages/components/description-list.vue index 8bbf29b84..83d82ed94 100644 --- a/playgrounds/demo/app/pages/components/description-list.vue +++ b/playgrounds/demo/app/pages/components/description-list.vue @@ -120,7 +120,7 @@ const itemsIcons: DescriptionListItem[] = [ label: 'Line 1.1', description: 'Description 1.1', avatar: { - src: '/b24ui/demo/avatar/employee.png' + src: '/avatar/employee.png' } }, { @@ -141,6 +141,24 @@ const itemsIcons: DescriptionListItem[] = [ } ] +const itemsLink: DescriptionListItem[] = [ + { + label: 'Account manager', + description: 'Sample owner', + to: '/users/owner' + }, + { + label: 'External profile', + description: 'View on partner portal', + to: 'https://example.com', + target: '_blank' + }, + { + label: 'Created', + description: 'Oct 6, 2024 08:37' + } +] + const itemsCustom: (DescriptionListItem & { value?: Date | string })[] = [ { label: 'Amount', @@ -198,6 +216,17 @@ const itemsCustom: (DescriptionListItem & { value?: Date | string })[] = [ + + +
+ +
+
+
diff --git a/playgrounds/nuxt/app/pages/components/description-list.vue b/playgrounds/nuxt/app/pages/components/description-list.vue index 97940d5c2..83d82ed94 100644 --- a/playgrounds/nuxt/app/pages/components/description-list.vue +++ b/playgrounds/nuxt/app/pages/components/description-list.vue @@ -141,6 +141,24 @@ const itemsIcons: DescriptionListItem[] = [ } ] +const itemsLink: DescriptionListItem[] = [ + { + label: 'Account manager', + description: 'Sample owner', + to: '/users/owner' + }, + { + label: 'External profile', + description: 'View on partner portal', + to: 'https://example.com', + target: '_blank' + }, + { + label: 'Created', + description: 'Oct 6, 2024 08:37' + } +] + const itemsCustom: (DescriptionListItem & { value?: Date | string })[] = [ { label: 'Amount', @@ -198,6 +216,17 @@ const itemsCustom: (DescriptionListItem & { value?: Date | string })[] = [
+ + +
+ +
+
+
diff --git a/src/runtime/components/DescriptionList.vue b/src/runtime/components/DescriptionList.vue index c449eb2f4..0631979d7 100644 --- a/src/runtime/components/DescriptionList.vue +++ b/src/runtime/components/DescriptionList.vue @@ -1,6 +1,7 @@