diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index c9cb31c4..b8f77fa2 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -372,23 +372,23 @@ export type BreakpointValue = 320 | 672 | 1056 | 1312 | 1584; ### Props -| Prop name | Required | Kind | Reactive | Type | Default value | Description | -| :--------------- | :------- | :--------------- | :------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| ref | No | let | Yes | null | HTMLAnchorElement | HTMLButtonElement | null | Obtain a reference to the HTML element | -| kind | No | let | No | "primary" | "secondary" | "tertiary" | "ghost" | "danger" | "danger-tertiary" | "danger-ghost" | "primary" | Specify the kind of button | -| size | No | let | No | "default" | "field" | "small" | "lg" | "xl" | "default" | Specify the size of button | -| expressive | No | let | No | boolean | false | Set to `true` to use Carbon's expressive typesetting | -| isSelected | No | let | No | boolean | false | Set to `true` to enable the selected state for an icon-only, ghost button | -| icon | No | let | No | typeof import("svelte").SvelteComponent | undefined | Specify the icon to render | -| iconDescription | No | let | No | string | undefined | Specify the ARIA label for the button icon | -| tooltipAlignment | No | let | No | "start" | "center" | "end" | "center" | Set the alignment of the tooltip relative to the icon.
Only applies to icon-only buttons | -| tooltipPosition | No | let | No | "top" | "right" | "bottom" | "left" | "bottom" | Set the position of the tooltip relative to the icon | -| as | No | let | No | boolean | false | Set to `true` to render a custom HTML element
Props are destructured as `props` in the default slot (e.g., <Button let:props><div {...props}>...</div></Button>) | -| skeleton | No | let | No | boolean | false | Set to `true` to display the skeleton state | -| disabled | No | let | No | boolean | false | Set to `true` to disable the button | -| href | No | let | No | string | undefined | Set the `href` to use an anchor link | -| tabindex | No | let | No | string | "0" | Specify the tabindex | -| type | No | let | No | string | "button" | Specify the `type` attribute for the button element | +| Prop name | Required | Kind | Reactive | Type | Default value | Description | +| :--------------- | :------- | :--------------- | :------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| ref | No | let | Yes | null | HTMLAnchorElement | HTMLButtonElement | null | Obtain a reference to the HTML element | +| kind | No | let | No | "primary" | "secondary" | "tertiary" | "ghost" | "danger" | "danger--tertiary" | "danger--ghost" | "primary" | Specify the kind of button | +| size | No | let | No | "sm" | "md" | "lg" | "xl" | "2xl" | "lg" | Specify the size of button | +| expressive | No | let | No | boolean | false | Set to `true` to use Carbon's expressive typesetting | +| isSelected | No | let | No | boolean | false | Set to `true` to enable the selected state for an icon-only, ghost button | +| icon | No | let | No | typeof import("svelte").SvelteComponent | undefined | Specify the icon to render | +| iconDescription | No | let | No | string | undefined | Specify the ARIA label for the button icon | +| tooltipAlignment | No | let | No | "start" | "center" | "end" | "center" | Set the alignment of the tooltip relative to the icon.
Only applies to icon-only buttons | +| tooltipPosition | No | let | No | "top" | "right" | "bottom" | "left" | "bottom" | Set the position of the tooltip relative to the icon | +| as | No | let | No | boolean | false | Set to `true` to render a custom HTML element
Props are destructured as `props` in the default slot (e.g., <Button let:props><div {...props}>...</div></Button>) | +| skeleton | No | let | No | boolean | false | Set to `true` to display the skeleton state | +| disabled | No | let | No | boolean | false | Set to `true` to disable the button | +| href | No | let | No | string | undefined | Set the `href` to use an anchor link | +| tabindex | No | let | No | string | "0" | Specify the tabindex | +| type | No | let | No | string | "button" | Specify the `type` attribute for the button element | ### Slots diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json index 929972c8..a67570f3 100644 --- a/docs/src/COMPONENT_API.json +++ b/docs/src/COMPONENT_API.json @@ -453,7 +453,7 @@ "name": "kind", "kind": "let", "description": "Specify the kind of button", - "type": "\"primary\" | \"secondary\" | \"tertiary\" | \"ghost\" | \"danger\" | \"danger-tertiary\" | \"danger-ghost\"", + "type": "\"primary\" | \"secondary\" | \"tertiary\" | \"ghost\" | \"danger\" | \"danger--tertiary\" | \"danger--ghost\"", "value": "\"primary\"", "isFunction": false, "isFunctionDeclaration": false, @@ -465,8 +465,8 @@ "name": "size", "kind": "let", "description": "Specify the size of button", - "type": "\"default\" | \"field\" | \"small\" | \"lg\" | \"xl\"", - "value": "\"default\"", + "type": "\"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\"", + "value": "\"lg\"", "isFunction": false, "isFunctionDeclaration": false, "isRequired": false, diff --git a/docs/src/pages/components/Button.svx b/docs/src/pages/components/Button.svx index 4ddece95..a32ea09d 100644 --- a/docs/src/pages/components/Button.svx +++ b/docs/src/pages/components/Button.svx @@ -30,7 +30,7 @@ ## Danger tertiary button - + ## Danger tertiary, icon-only button @@ -40,11 +40,11 @@ - + ## Button with icon @@ -90,36 +90,36 @@ If an `href` value is specified, the component will render an [anchor element](h ## Field size - - - - - + + + + + ## Small size - - - - - + + + + + ## Large size - - - - - - -## Extra-large size - +## Extra-large size + + + + + + + ## Disabled state diff --git a/src/Button/Button.svelte b/src/Button/Button.svelte index 37e054e9..178e631f 100644 --- a/src/Button/Button.svelte +++ b/src/Button/Button.svelte @@ -7,15 +7,15 @@ /** * Specify the kind of button - * @type {"primary" | "secondary" | "tertiary" | "ghost" | "danger" | "danger-tertiary" | "danger-ghost"} + * @type {"primary" | "secondary" | "tertiary" | "ghost" | "danger" | "danger--tertiary" | "danger--ghost"} */ export let kind = "primary"; /** * Specify the size of button - * @type {"default" | "field" | "small" | "lg" | "xl"} + * @type {"sm" | "md" | "lg" | "xl" | "2xl"} */ - export let size = "default"; + export let size = "lg"; /** Set to `true` to use Carbon's expressive typesetting */ export let expressive = false; @@ -101,12 +101,11 @@ (size === "sm" && !expressive) || (size === "small" && !expressive)) && "bx--btn--sm", - (size === "field" && !expressive) || - (size === "md" && !expressive && "bx--btn--md"), - size === "field" && "bx--btn--field", + ((size === "field" && !expressive) || (size === "md" && !expressive)) && + "bx--btn--md", size === "small" && "bx--btn--sm", - size === "lg" && "bx--btn--lg", size === "xl" && "bx--btn--xl", + size === "2xl" && "bx--btn--2xl", kind && `bx--btn--${kind}`, disabled && "bx--btn--disabled", hasIconOnly && "bx--btn--icon-only", diff --git a/tests/Button.test.svelte b/tests/Button.test.svelte index 189de59c..3e1efe43 100644 --- a/tests/Button.test.svelte +++ b/tests/Button.test.svelte @@ -13,9 +13,9 @@ - + - + @@ -32,30 +32,30 @@

Custom element

- + - + - + - + - + - + - + - + - + - + + Learn more - +

Resources are provisioned based on your account's organization.

diff --git a/types/Button/Button.svelte.d.ts b/types/Button/Button.svelte.d.ts index ced3d8a1..05a1d440 100644 --- a/types/Button/Button.svelte.d.ts +++ b/types/Button/Button.svelte.d.ts @@ -18,14 +18,14 @@ export interface ButtonProps extends ButtonSkeletonProps, RestProps { | "tertiary" | "ghost" | "danger" - | "danger-tertiary" - | "danger-ghost"; + | "danger--tertiary" + | "danger--ghost"; /** * Specify the size of button - * @default "default" + * @default "lg" */ - size?: "default" | "field" | "small" | "lg" | "xl"; + size?: "sm" | "md" | "lg" | "xl" | "2xl"; /** * Set to `true` to use Carbon's expressive typesetting