Skip to content

Commit 5dfb126

Browse files
committed
feat(CSidebarBrand): allows to rendering the component as a link
1 parent b5c0864 commit 5dfb126

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

packages/coreui-vue/src/components/sidebar/CSidebarBrand.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,27 @@ import { defineComponent, h } from 'vue'
22

33
const CSidebarBrand = defineComponent({
44
name: 'CSidebarBrand',
5-
setup(_, { slots }) {
6-
return () => h('div', { class: 'sidebar-brand' }, slots.default && slots.default())
5+
props: {
6+
/**
7+
* Component used for the root node. Either a string to use a HTML element or a component.
8+
*
9+
*/
10+
as: {
11+
type: String,
12+
default: 'div',
13+
},
14+
/**
15+
* The href attribute specifies the URL of the page the link goes to.
16+
*/
17+
href: String,
18+
},
19+
setup(props, { slots }) {
20+
return () =>
21+
h(
22+
props.as ?? (props.href ? 'a' : 'div'),
23+
{ class: 'sidebar-brand', href: props.href },
24+
slots.default && slots.default(),
25+
)
726
},
827
})
928

packages/docs/api/sidebar/CSidebarBrand.api.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,10 @@ import { CSidebarBrand } from '@coreui/vue'
55
// or
66
import CSidebarBrand from '@coreui/vue/src/components/sidebar/CSidebarBrand'
77
```
8+
9+
#### Props
10+
11+
| Prop name | Description | Type | Values | Default |
12+
| --------- | --------------------------------------------------------------------------------------- | ------ | ------ | ------- |
13+
| **as** | Component used for the root node. Either a string to use a HTML element or a component. | string | - | 'div' |
14+
| **href** | The href attribute specifies the URL of the page the link goes to. | string | - | - |

0 commit comments

Comments
 (0)