Skip to content

Commit 8152c34

Browse files
committed
feat(CNav): add the underline variant
1 parent d902af9 commit 8152c34

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

packages/coreui-react/src/components/nav/CNav.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export interface CNavProps
1919
/**
2020
* Set the nav variant to tabs or pills.
2121
*/
22-
variant?: 'tabs' | 'pills'
22+
variant?: 'pills' | 'tabs' | 'underline'
2323
}
2424

2525
export const CNav = forwardRef<HTMLDivElement | HTMLUListElement | HTMLOListElement, CNavProps>(
@@ -49,7 +49,7 @@ CNav.propTypes = {
4949
className: PropTypes.string,
5050
component: PropTypes.elementType,
5151
layout: PropTypes.oneOf(['fill', 'justified']),
52-
variant: PropTypes.oneOf(['tabs', 'pills']),
52+
variant: PropTypes.oneOf(['pills', 'tabs', 'underline']),
5353
}
5454

5555
CNav.displayName = 'CNav'

packages/docs/content/components/navs-tabs.mdx

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ Takes the basic nav from above and adds the `variant="tabs"` class to generate a
172172

173173
### Pills
174174

175-
Take that same HTML, but use `variant="pills"` instead:
175+
Take that same code, but use `variant="pills"` instead:
176176

177177
```jsx preview
178178
<CNav variant="pills">
@@ -195,6 +195,31 @@ Take that same HTML, but use `variant="pills"` instead:
195195
</CNav>
196196
```
197197

198+
### Underline
199+
200+
Take that same code, but use `variant="underline"` instead:
201+
202+
```jsx preview
203+
<CNav variant="underline">
204+
<CNavItem>
205+
<CNavLink href="#" active>
206+
Active
207+
</CNavLink>
208+
</CNavItem>
209+
<CNavItem>
210+
<CNavLink href="#">Link</CNavLink>
211+
</CNavItem>
212+
<CNavItem>
213+
<CNavLink href="#">Link</CNavLink>
214+
</CNavItem>
215+
<CNavItem>
216+
<CNavLink href="#" disabled>
217+
Disabled
218+
</CNavLink>
219+
</CNavItem>
220+
</CNav>
221+
```
222+
198223
### Fill and justify
199224

200225
Force your `<CNav>`'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)