mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 19:46:36 +00:00
* refactor(search): resolve svelte file paths * docs(Search): add reactive example * refactor(tag): use class name directive for tag types, resolve svelte icon path * chore(button-skeleton): deprecate small prop * fix(breadcrumb-item): type default slot * refactor(breadcrumb-skeleton): omit unused index * refactor(aspect-ratio): use class name directive * refactor(accordion): use the class name directive, resolve svelte icon paths * refactor(code-snippet): use class name directive, resolve svelte icon paths * fix(code-snippet-skeleton): CodeSnippetSkeleton can only be single or multi * refactor(content-switcher): use class name directive * docs(content-switcher): add reactive example * docs(content-switcher): remove unused import * docs(toggle): add reactive example * refactor(tooltip-definition): use class name directive * refactor(tooltip-icon): use class name directive * refactor(tooltip): resolve svelte icon import * fix(select): type dispatched change event * refactor(select): resolve svelte icon import * feat(select-item): spread rest props, avoid $ variable name * fix(pagination-nav): type dispatched events * refactor(pagination): resolve svelte imports * fix(pagination): type dispatched update event * fix(overflow-menu): type dispatched close event * fix(number-input): type dispatched change event * refactor(modal): use class name directive, resolve svelte imports * refactor(inline-loading): use class name directive, resolve svelte imports * refactor(composed-modal): resolve svelte icon imports * refactor(combo-box): resolve svelte imports * fix(fluid-form): rest props should not override Form class * refactor(progress-step): resolve svelte icon imports
72 lines
No EOL
1.5 KiB
Text
72 lines
No EOL
1.5 KiB
Text
---
|
|
components: ["ContentSwitcher", "Switch"]
|
|
---
|
|
|
|
<script>
|
|
import { ContentSwitcher, Switch } from "carbon-components-svelte";
|
|
import Bullhorn16 from "carbon-icons-svelte/lib/Bullhorn16";
|
|
import Analytics16 from "carbon-icons-svelte/lib/Analytics16";
|
|
import Preview from "../../components/Preview.svelte";
|
|
</script>
|
|
|
|
### Default
|
|
|
|
<ContentSwitcher>
|
|
<Switch text="Latest news" />
|
|
<Switch text="Trending" />
|
|
</ContentSwitcher>
|
|
|
|
### Initial selected index
|
|
|
|
<ContentSwitcher selectedIndex={1}>
|
|
<Switch text="Latest news" />
|
|
<Switch text="Trending" />
|
|
<Switch text="Recommended" />
|
|
</ContentSwitcher>
|
|
|
|
### Reactive example
|
|
|
|
<FileSource src="/framed/ContentSwitcher/ContentSwitcherReactive" />
|
|
|
|
### Light variant
|
|
|
|
<ContentSwitcher light>
|
|
<Switch text="Latest news" />
|
|
<Switch text="Trending" />
|
|
</ContentSwitcher>
|
|
|
|
### Custom switch slot
|
|
|
|
<ContentSwitcher>
|
|
<Switch>
|
|
<div style="display: flex; align-items: center;">
|
|
<Bullhorn16 style="margin-right: 0.5rem;" /> Latest news
|
|
</div>
|
|
</Switch>
|
|
<Switch>
|
|
<div style="display: flex; align-items: center;">
|
|
<Analytics16 style="margin-right: 0.5rem;" /> Trending
|
|
</div>
|
|
</Switch>
|
|
</ContentSwitcher>
|
|
|
|
### Extra-large size
|
|
|
|
<ContentSwitcher size="xl">
|
|
<Switch text="All" />
|
|
<Switch text="Archived" />
|
|
</ContentSwitcher>
|
|
|
|
### Small size
|
|
|
|
<ContentSwitcher size="sm">
|
|
<Switch text="All" />
|
|
<Switch text="Archived" />
|
|
</ContentSwitcher>
|
|
|
|
### Disabled
|
|
|
|
<ContentSwitcher>
|
|
<Switch disabled text="All" />
|
|
<Switch disabled text="Archived" />
|
|
</ContentSwitcher> |