mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
feat(content-switcher): add "sm", "xl" size variants
This commit is contained in:
parent
f692403fcc
commit
3edf9ea2a2
4 changed files with 34 additions and 5 deletions
|
@ -857,10 +857,11 @@ import { ContentSwitcher } from "carbon-components-svelte";
|
||||||
|
|
||||||
### Props
|
### Props
|
||||||
|
|
||||||
| Prop name | Type | Default value |
|
| Prop name | Type | Default value |
|
||||||
| :------------ | :------------------- | :------------ |
|
| :------------ | :---------------------------- | :------------ |
|
||||||
| selectedIndex | <code>number</code> | 0 |
|
| selectedIndex | <code>number</code> | 0 |
|
||||||
| light | <code>boolean</code> | false |
|
| light | <code>boolean</code> | false |
|
||||||
|
| size | <code>"sm" | "xl"</code> | -- |
|
||||||
|
|
||||||
### Slots
|
### Slots
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,22 @@
|
||||||
<Switch text="Switch 2" />
|
<Switch text="Switch 2" />
|
||||||
</ContentSwitcher>
|
</ContentSwitcher>
|
||||||
|
|
||||||
|
### Extra-large size
|
||||||
|
|
||||||
|
<ContentSwitcher size="xl">
|
||||||
|
<Switch text="Switch 1" />
|
||||||
|
<Switch text="Switch 2" />
|
||||||
|
<Switch text="Switch 3" />
|
||||||
|
</ContentSwitcher>
|
||||||
|
|
||||||
|
### Small size
|
||||||
|
|
||||||
|
<ContentSwitcher size="sm">
|
||||||
|
<Switch text="Switch 1" />
|
||||||
|
<Switch text="Switch 2" />
|
||||||
|
<Switch text="Switch 3" />
|
||||||
|
</ContentSwitcher>
|
||||||
|
|
||||||
### Disabled
|
### Disabled
|
||||||
|
|
||||||
<ContentSwitcher>
|
<ContentSwitcher>
|
||||||
|
|
|
@ -11,6 +11,12 @@
|
||||||
*/
|
*/
|
||||||
export let light = false;
|
export let light = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify the size of the content switcher
|
||||||
|
* @type {"sm" | "xl"} [size]
|
||||||
|
*/
|
||||||
|
export let size = undefined;
|
||||||
|
|
||||||
import { afterUpdate, createEventDispatcher, setContext } from "svelte";
|
import { afterUpdate, createEventDispatcher, setContext } from "svelte";
|
||||||
import { writable } from "svelte/store";
|
import { writable } from "svelte/store";
|
||||||
|
|
||||||
|
@ -61,6 +67,7 @@
|
||||||
class:bx--content-switcher="{true}"
|
class:bx--content-switcher="{true}"
|
||||||
class:bx--content-switcher--light="{light}"
|
class:bx--content-switcher--light="{light}"
|
||||||
{...$$restProps}
|
{...$$restProps}
|
||||||
|
class="{size && `bx--content-switcher--${size}`} {$$restProps.class}"
|
||||||
on:click
|
on:click
|
||||||
on:mouseover
|
on:mouseover
|
||||||
on:mouseenter
|
on:mouseenter
|
||||||
|
|
7
types/index.d.ts
vendored
7
types/index.d.ts
vendored
|
@ -261,7 +261,7 @@ export class ButtonSkeleton extends CarbonSvelteComponent {
|
||||||
size?: "default" | "field" | "small";
|
size?: "default" | "field" | "small";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Set to `true` to use the small variant
|
||||||
* @default false
|
* @default false
|
||||||
*/
|
*/
|
||||||
small?: boolean;
|
small?: boolean;
|
||||||
|
@ -717,6 +717,11 @@ export class ContentSwitcher extends CarbonSvelteComponent {
|
||||||
* @default false
|
* @default false
|
||||||
*/
|
*/
|
||||||
light?: boolean;
|
light?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify the size of the content switcher
|
||||||
|
*/
|
||||||
|
size?: "sm" | "xl";
|
||||||
};
|
};
|
||||||
|
|
||||||
$$slot_def: { default: {} };
|
$$slot_def: { default: {} };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue