Skip to content

Commit 78faafc

Browse files
committed
docs(tabs): add "With icons" example
1 parent c520ce6 commit 78faafc

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

docs/src/pages/components/Tabs.svx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ components: ["Tabs", "Tab", "TabContent", "TabsSkeleton"]
44

55
<script>
66
import { Tabs, Tab, TabContent, TabsSkeleton } from "carbon-components-svelte";
7+
import Calendar from "carbon-icons-svelte/lib/Calendar.svelte";
8+
import Information from "carbon-icons-svelte/lib/Information.svelte";
9+
import Settings from "carbon-icons-svelte/lib/Settings.svelte";
710
</script>
811

912
Tabs provide a way to organize content into separate views that can be switched between. They support keyboard navigation, disabled states, and various layout options.
@@ -69,6 +72,21 @@ Set `disabled` to `true` on a tab component to prevent interaction. Keyboard nav
6972
</svelte:fragment>
7073
</Tabs>
7174

75+
## With icons
76+
77+
Use the `icon` prop to render an icon next to the tab label. The icon is rendered to the right of the label.
78+
79+
<Tabs>
80+
<Tab label="Calendar" icon={Calendar} />
81+
<Tab label="Information" icon={Information} />
82+
<Tab label="Settings" icon={Settings} disabled />
83+
<svelte:fragment slot="content">
84+
<TabContent>Calendar content</TabContent>
85+
<TabContent>Information content</TabContent>
86+
<TabContent>Settings content</TabContent>
87+
</svelte:fragment>
88+
</Tabs>
89+
7290
## Container type
7391

7492
Use the container type for a more prominent tab interface.

0 commit comments

Comments
 (0)