Skip to content

Commit 5c26db6

Browse files
committed
feat(CNav): add enclosed variants
1 parent f0ad650 commit 5c26db6

File tree

3 files changed

+97
-6
lines changed

3 files changed

+97
-6
lines changed

packages/coreui-vue/src/components/nav/CNav.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ const CNav = defineComponent({
2424
/**
2525
* Set the nav variant to tabs or pills.
2626
*
27-
* @values 'pills', 'tabs', 'underline', 'underline-border'
27+
* @values 'enclosed', 'enclosed-pills', 'pills', 'tabs', 'underline', 'underline-border'
2828
*/
2929
variant: {
3030
type: String,
3131
validator: (value: string) => {
32-
return ['pills', 'tabs', 'underline', 'underline-border'].includes(value)
32+
return ['enclosed', 'enclosed-pills', 'pills', 'tabs', 'underline', 'underline-border'].includes(value)
3333
},
3434
},
3535
},
@@ -40,6 +40,7 @@ const CNav = defineComponent({
4040
{
4141
class: [
4242
'nav',
43+
props.variant === 'enclosed-pills' && 'nav-enclosed',
4344
{
4445
[`nav-${props.layout}`]: props.layout,
4546
[`nav-${props.variant}`]: props.variant,

packages/docs/api/tabs/CTabList.api.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import CTabList from '@coreui/vue/src/components/tabs/CTabList'
88

99
#### Props
1010

11-
| Prop name | Description | Type | Values | Default |
12-
| ----------- | ------------------------------------- | ------ | -------------------------------------------------------- | ------- |
13-
| **layout** | Specify a layout type for component. | string | `'fill'`, `'justified'` | - |
14-
| **variant** | Set the nav variant to tabs or pills. | string | `'pills'`, `'tabs'`, `'underline'`, `'underline-border'` | - |
11+
| Prop name | Description | Type | Values | Default |
12+
| ----------- | ------------------------------------- | ------ | ------------------------------------------------------------------------------------------ | ------- |
13+
| **layout** | Specify a layout type for component. | string | `'fill'`, `'justified'` | - |
14+
| **variant** | Set the nav variant to tabs or pills. | string | `'enclosed'`, `'enclosed-pills'`, `'pills'`, `'tabs'`, `'underline'`, `'underline-border'` | - |

packages/docs/components/navs-tabs.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,96 @@ Take that same code, but use `variant="underline-border"` instead:
402402
</CNav>
403403
```
404404

405+
### Enclosed
406+
407+
Use the `variant="enclosed"` class to give your navigation items a subtle border and rounded styling.
408+
409+
::: demo
410+
<CNav variant="enclosed">
411+
<CNavItem>
412+
<CNavLink href="#" active>
413+
Active
414+
</CNavLink>
415+
</CNavItem>
416+
<CNavItem>
417+
<CNavLink href="#">Link</CNavLink>
418+
</CNavItem>
419+
<CNavItem>
420+
<CNavLink href="#">Link</CNavLink>
421+
</CNavItem>
422+
<CNavItem>
423+
<CNavLink href="#" disabled>
424+
Disabled
425+
</CNavLink>
426+
</CNavItem>
427+
</CNav>
428+
:::
429+
```vue
430+
<CNav variant="enclosed">
431+
<CNavItem>
432+
<CNavLink href="#" active>
433+
Active
434+
</CNavLink>
435+
</CNavItem>
436+
<CNavItem>
437+
<CNavLink href="#">Link</CNavLink>
438+
</CNavItem>
439+
<CNavItem>
440+
<CNavLink href="#">Link</CNavLink>
441+
</CNavItem>
442+
<CNavItem>
443+
<CNavLink href="#" disabled>
444+
Disabled
445+
</CNavLink>
446+
</CNavItem>
447+
</CNav>
448+
```
449+
450+
### Enclosed pills
451+
452+
Use the `variant="enclosed-pills"` to achieve a pill-style appearance for each nav item, using pill-shaped borders and smoother outlines.
453+
454+
::: demo
455+
<CNav variant="enclosed-pills">
456+
<CNavItem>
457+
<CNavLink href="#" active>
458+
Active
459+
</CNavLink>
460+
</CNavItem>
461+
<CNavItem>
462+
<CNavLink href="#">Link</CNavLink>
463+
</CNavItem>
464+
<CNavItem>
465+
<CNavLink href="#">Link</CNavLink>
466+
</CNavItem>
467+
<CNavItem>
468+
<CNavLink href="#" disabled>
469+
Disabled
470+
</CNavLink>
471+
</CNavItem>
472+
</CNav>
473+
:::
474+
```vue
475+
<CNav variant="enclosed-pills">
476+
<CNavItem>
477+
<CNavLink href="#" active>
478+
Active
479+
</CNavLink>
480+
</CNavItem>
481+
<CNavItem>
482+
<CNavLink href="#">Link</CNavLink>
483+
</CNavItem>
484+
<CNavItem>
485+
<CNavLink href="#">Link</CNavLink>
486+
</CNavItem>
487+
<CNavItem>
488+
<CNavLink href="#" disabled>
489+
Disabled
490+
</CNavLink>
491+
</CNavItem>
492+
</CNav>
493+
```
494+
405495
### Fill and justify
406496

407497
Force your `.nav`'s contents to extend the full available width one of two modifier classes. To proportionately fill all available space with your `.nav-item`s, use `layout="fill"`. Notice that all horizontal space is occupied, but not every nav item has the same width.

0 commit comments

Comments
 (0)