Sidebar Item
A single navigation row for fandry-sidebar, with an active/current-page state.
fandry-sidebar-item
Example
Link to section ExampleCustom colors and parts
Link to section Custom colors and partsThe same component with a few --fd-* tokens set around it and its parts restyled. The code is under Parts below.
Props
Link to section Props| Prop | Type | Default | Description |
|---|---|---|---|
href | string | '' | Link target. |
active | boolean | false | Marks this as the current page (styling + aria-current). |
Parts
Link to section PartsStyle the elements inside the component from your own CSS with ::part(). Every fandry component renders in native shadow DOM, so parts work on LWR and Salesforce alike. For colors, spacing, radius and type across many components, set the --fd-* tokens instead. The code for the "Custom colors and parts" example above:
| Part | Description |
|---|---|
base | The outermost element. |
link | The native <a>. |
States are extra names on a part while the state is on. Name both to style one state, e.g.fandry-checkbox::part(control checked).
| State | Description |
|---|---|
current | The link to the page being viewed. |
<!-- template -->
<div class="brand narrow" onclick={handleNoopClick}>
<fandry-sidebar aria-label="Shop">
<fandry-sidebar-item href="#" active>Shoes</fandry-sidebar-item>
<fandry-sidebar-item href="#">Bags</fandry-sidebar-item>
<fandry-sidebar-item href="#">Home</fandry-sidebar-item>
</fandry-sidebar>
</div>
/* css */
/* Scoped to this demo. Set the same --fd-* tokens on :root to theme
every fandry-* component on the site. */
.brand {
--fd-primary: 160 84% 26%;
--fd-radius-md: 999px;
}
fandry-sidebar::part(base) {
padding: 0.5rem;
background: hsl(160 40% 97%);
border-radius: 1rem;
}
fandry-sidebar-item::part(link) {
font-weight: 600;
}
Code
Link to section Code<fandry-sidebar-item href="/components/card" active>Card</fandry-sidebar-item>