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.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 elementlet
| 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 | HTMLElement
| 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 |
+| selected | 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.let
| No | "top" | "right" | "bottom" | "left"
| "bottom"
| Set the position of the tooltip relative to the icon |
+| as | No | let
| No | keyof import('svelte/elements').SvelteHTMLElements
| undefined
| Specify an element name to render as the button.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 |
+| buttonAttributes | No | let
| No | import('svelte/elements').HTMLAnchorAttributes | |
+| import('svelte/elements').HTMLButtonAttributes | import('svelte/elements').HTMLAttributes
| {}
| Button, anchor, or div attributes |
### Slots
-| Slot name | Default | Props | Fallback |
-| :-------- | :------ | :---------------------------------------------------------------------------------------------------------------------------------------------- | :------- |
-| -- | Yes | { props: { role: "button"; type?: string; tabindex: any; disabled: boolean; href?: string; class: string; [key: string]: any; } }
| -- |
+| Slot name | Default | Props | Fallback |
+| :-------- | :------ | :---- | :------- |
+| -- | Yes | -- | -- |
### Events
-| Event name | Type | Detail |
-| :--------- | :-------- | :----- |
-| click | forwarded | -- |
-| focus | forwarded | -- |
-| blur | forwarded | -- |
-| mouseover | forwarded | -- |
-| mouseenter | forwarded | -- |
-| mouseleave | forwarded | -- |
+| Event name | Type | Detail |
+| :----------- | :-------- | :----- |
+| click | forwarded | -- |
+| focus | forwarded | -- |
+| blur | forwarded | -- |
+| pointerover | forwarded | -- |
+| pointerenter | forwarded | -- |
+| pointerleave | forwarded | -- |
## `ButtonSet`
diff --git a/css/all.scss b/css/all.scss
index 8a051526..6864a2fa 100644
--- a/css/all.scss
+++ b/css/all.scss
@@ -1,7 +1,9 @@
+$prefix: 'bx';
+
// Use all Carbon themes
@use '@carbon/styles/scss/config' with (
$use-akamai-cdn: true,
- $prefix: 'bx'
+ $prefix: $prefix
);
@use "@carbon/styles" as styles;
@use "@carbon/styles/scss/utilities" as *;
@@ -22,9 +24,9 @@
@include styles.theme(styles.$g100);
}
-.bx--text-truncate-end {
+.#{$prefix}--text-truncate-end {
@include text-truncate-end;
}
-.bx--text-truncate-front {
+.#{$prefix}--text-truncate-front {
@include text-truncate-front;
}
diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json
index a86fb2a0..706aea11 100644
--- a/docs/src/COMPONENT_API.json
+++ b/docs/src/COMPONENT_API.json
@@ -486,7 +486,7 @@
"reactive": false
},
{
- "name": "isSelected",
+ "name": "selected",
"kind": "let",
"description": "Set to `true` to enable the selected state for an icon-only, ghost button",
"type": "boolean",
@@ -546,21 +546,8 @@
{
"name": "as",
"kind": "let",
- "description": "Set to `true` to render a custom HTML element\nProps are destructured as `props` in the default slot (e.g., )",
- "type": "boolean",
- "value": "false",
- "isFunction": false,
- "isFunctionDeclaration": false,
- "isRequired": false,
- "constant": false,
- "reactive": false
- },
- {
- "name": "skeleton",
- "kind": "let",
- "description": "Set to `true` to display the skeleton state",
- "type": "boolean",
- "value": "false",
+ "description": "Specify an element name to render as the button.\nBe sure to provide",
+ "type": "keyof import('svelte/elements').SvelteHTMLElements",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
@@ -618,49 +605,50 @@
"name": "ref",
"kind": "let",
"description": "Obtain a reference to the HTML element",
- "type": "null | HTMLAnchorElement | HTMLButtonElement",
+ "type": "null | HTMLElement",
"value": "null",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
"constant": false,
"reactive": true
+ },
+ {
+ "name": "buttonAttributes",
+ "kind": "let",
+ "description": "Button, anchor, or div attributes",
+ "type": "import('svelte/elements').HTMLAnchorAttributes |\nimport('svelte/elements').HTMLButtonAttributes | import('svelte/elements').HTMLAttributes",
+ "value": "{}",
+ "isFunction": false,
+ "isFunctionDeclaration": false,
+ "isRequired": false,
+ "constant": false,
+ "reactive": false
}
],
"moduleExports": [],
- "slots": [
- {
- "name": "__default__",
- "default": true,
- "slot_props": "{ props: { role: \"button\"; type?: string; tabindex: any; disabled: boolean; href?: string; class: string; [key: string]: any; } }"
- }
- ],
+ "slots": [{ "name": "__default__", "default": true, "slot_props": "{}" }],
"events": [
- { "type": "forwarded", "name": "click", "element": "ButtonSkeleton" },
- { "type": "forwarded", "name": "focus", "element": "ButtonSkeleton" },
- { "type": "forwarded", "name": "blur", "element": "ButtonSkeleton" },
+ { "type": "forwarded", "name": "click", "element": "svelte:element" },
+ { "type": "forwarded", "name": "focus", "element": "svelte:element" },
+ { "type": "forwarded", "name": "blur", "element": "svelte:element" },
{
"type": "forwarded",
- "name": "mouseover",
- "element": "ButtonSkeleton"
+ "name": "pointerover",
+ "element": "svelte:element"
},
{
"type": "forwarded",
- "name": "mouseenter",
- "element": "ButtonSkeleton"
+ "name": "pointerenter",
+ "element": "svelte:element"
},
{
"type": "forwarded",
- "name": "mouseleave",
- "element": "ButtonSkeleton"
+ "name": "pointerleave",
+ "element": "svelte:element"
}
],
- "typedefs": [],
- "rest_props": { "type": "Element", "name": "button | a | div" },
- "extends": {
- "interface": "ButtonSkeletonProps",
- "import": "\"./ButtonSkeleton.svelte\""
- }
+ "typedefs": []
},
{
"moduleName": "ButtonSet",
diff --git a/docs/src/pages/components/Button.svx b/docs/src/pages/components/Button.svx
index db942157..e6afd1a7 100644
--- a/docs/src/pages/components/Button.svx
+++ b/docs/src/pages/components/Button.svx
@@ -36,7 +36,7 @@