mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
parent
8d5ef9c93e
commit
a9460e944d
5 changed files with 59 additions and 9 deletions
|
@ -3209,11 +3209,13 @@ None.
|
||||||
### Props
|
### Props
|
||||||
|
|
||||||
| Prop name | Required | Kind | Reactive | Type | Default value | Description |
|
| Prop name | Required | Kind | Reactive | Type | Default value | Description |
|
||||||
| :-------- | :------- | :--------------- | :------- | --------------------------------- | ------------------ | ----------------------------------- |
|
| :-------- | :------- | :--------------- | :------- | --------------------------------- | ---------------------- | ----------------------------------------- |
|
||||||
| value | No | <code>let</code> | No | <code>string | number</code> | <code>""</code> | Specify the option value |
|
| value | No | <code>let</code> | No | <code>string | number</code> | <code>""</code> | Specify the option value |
|
||||||
| text | No | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the option text |
|
| text | No | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the option text |
|
||||||
| hidden | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to hide the option |
|
| hidden | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to hide the option |
|
||||||
| disabled | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to disable the option |
|
| disabled | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to disable the option |
|
||||||
|
| class | No | <code>let</code> | No | <code>string</code> | <code>undefined</code> | Specify the class of the `option` element |
|
||||||
|
| style | No | <code>let</code> | No | <code>string</code> | <code>undefined</code> | Specify the style of the `option` element |
|
||||||
|
|
||||||
### Slots
|
### Slots
|
||||||
|
|
||||||
|
|
|
@ -10452,6 +10452,28 @@
|
||||||
"isRequired": false,
|
"isRequired": false,
|
||||||
"constant": false,
|
"constant": false,
|
||||||
"reactive": false
|
"reactive": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "class",
|
||||||
|
"kind": "let",
|
||||||
|
"description": "Specify the class of the `option` element",
|
||||||
|
"type": "string",
|
||||||
|
"isFunction": false,
|
||||||
|
"isFunctionDeclaration": false,
|
||||||
|
"isRequired": false,
|
||||||
|
"constant": false,
|
||||||
|
"reactive": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "style",
|
||||||
|
"kind": "let",
|
||||||
|
"description": "Specify the style of the `option` element",
|
||||||
|
"type": "string",
|
||||||
|
"isFunction": false,
|
||||||
|
"isFunctionDeclaration": false,
|
||||||
|
"isRequired": false,
|
||||||
|
"constant": false,
|
||||||
|
"reactive": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"moduleExports": [],
|
"moduleExports": [],
|
||||||
|
|
|
@ -14,6 +14,20 @@
|
||||||
/** Set to `true` to disable the option */
|
/** Set to `true` to disable the option */
|
||||||
export let disabled = false;
|
export let disabled = false;
|
||||||
|
|
||||||
|
let className = undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify the class of the `option` element
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
export { className as class };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify the style of the `option` element
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
export let style = undefined;
|
||||||
|
|
||||||
import { getContext, onMount } from "svelte";
|
import { getContext, onMount } from "svelte";
|
||||||
|
|
||||||
const id = "ccs-" + Math.random().toString(36);
|
const id = "ccs-" + Math.random().toString(36);
|
||||||
|
@ -38,8 +52,8 @@
|
||||||
hidden="{hidden}"
|
hidden="{hidden}"
|
||||||
selected="{selected}"
|
selected="{selected}"
|
||||||
class:bx--select-option="{true}"
|
class:bx--select-option="{true}"
|
||||||
class="{$$restProps.class}"
|
class="{className}"
|
||||||
style="{$$restProps.style}"
|
style="{style}"
|
||||||
>
|
>
|
||||||
{text || value}
|
{text || value}
|
||||||
</option>
|
</option>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Select labelText="Carbon theme" selected="g10">
|
<Select labelText="Carbon theme" selected="g10">
|
||||||
<SelectItem value="white" text="White" />
|
<SelectItem value="white" text="White" class="" style="" />
|
||||||
<SelectItem value="g10" text="Gray 10" />
|
<SelectItem value="g10" text="Gray 10" />
|
||||||
<SelectItem value="g90" text="Gray 90" />
|
<SelectItem value="g90" text="Gray 90" />
|
||||||
<SelectItem value="g100" text="Gray 100" />
|
<SelectItem value="g100" text="Gray 100" />
|
||||||
|
|
12
types/Select/SelectItem.svelte.d.ts
vendored
12
types/Select/SelectItem.svelte.d.ts
vendored
|
@ -24,6 +24,18 @@ export interface SelectItemProps {
|
||||||
* @default false
|
* @default false
|
||||||
*/
|
*/
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify the class of the `option` element
|
||||||
|
* @default undefined
|
||||||
|
*/
|
||||||
|
class?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify the style of the `option` element
|
||||||
|
* @default undefined
|
||||||
|
*/
|
||||||
|
style?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class SelectItem extends SvelteComponentTyped<
|
export default class SelectItem extends SvelteComponentTyped<
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue