mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 11:36:36 +00:00
feat(ui-shell): add isSelected prop to HeaderNavItem
This commit is contained in:
parent
a345688554
commit
00422d1ab8
4 changed files with 23 additions and 5 deletions
|
@ -1653,11 +1653,12 @@ None.
|
|||
|
||||
### Props
|
||||
|
||||
| Prop name | Kind | Reactive | Type | Default value | Description |
|
||||
| :-------- | :--------------- | :------- | :----------------------------------------- | ----------------- | --------------------------------------------- |
|
||||
| ref | <code>let</code> | Yes | <code>null | HTMLAnchorElement</code> | <code>null</code> | Obtain a reference to the HTML anchor element |
|
||||
| href | <code>let</code> | No | <code>string</code> | -- | Specify the `href` attribute |
|
||||
| text | <code>let</code> | No | <code>string</code> | -- | Specify the text |
|
||||
| Prop name | Kind | Reactive | Type | Default value | Description |
|
||||
| :--------- | :--------------- | :------- | :----------------------------------------- | ----------------- | --------------------------------------------- |
|
||||
| ref | <code>let</code> | Yes | <code>null | HTMLAnchorElement</code> | <code>null</code> | Obtain a reference to the HTML anchor element |
|
||||
| href | <code>let</code> | No | <code>string</code> | -- | Specify the `href` attribute |
|
||||
| text | <code>let</code> | No | <code>string</code> | -- | Specify the text |
|
||||
| isSelected | <code>let</code> | No | -- | -- | Set to `true` to select the item |
|
||||
|
||||
### Slots
|
||||
|
||||
|
|
|
@ -4078,6 +4078,14 @@
|
|||
"constant": false,
|
||||
"reactive": false
|
||||
},
|
||||
{
|
||||
"name": "isSelected",
|
||||
"kind": "let",
|
||||
"description": "Set to `true` to select the item",
|
||||
"isFunction": false,
|
||||
"constant": false,
|
||||
"reactive": false
|
||||
},
|
||||
{
|
||||
"name": "ref",
|
||||
"kind": "let",
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
*/
|
||||
export let text = undefined;
|
||||
|
||||
/** Set to `true` to select the item */
|
||||
export let isSelected = undefined;
|
||||
|
||||
/** Obtain a reference to the HTML anchor element */
|
||||
export let ref = null;
|
||||
</script>
|
||||
|
@ -23,6 +26,7 @@
|
|||
href="{href}"
|
||||
rel="{$$restProps.target === '_blank' ? 'noopener noreferrer' : undefined}"
|
||||
class:bx--header__menu-item="{true}"
|
||||
aria-current="{isSelected ? 'page' : undefined}"
|
||||
{...$$restProps}
|
||||
on:click
|
||||
on:mouseover
|
||||
|
|
|
@ -13,6 +13,11 @@ export interface HeaderNavItemProps
|
|||
*/
|
||||
text?: string;
|
||||
|
||||
/**
|
||||
* Set to `true` to select the item
|
||||
*/
|
||||
isSelected?: undefined;
|
||||
|
||||
/**
|
||||
* Obtain a reference to the HTML anchor element
|
||||
* @default null
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue