mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
fix: add a value prop to Checkbox (#849)
This commit is contained in:
parent
e0d5e6133e
commit
fed34e40ed
4 changed files with 22 additions and 0 deletions
|
@ -463,6 +463,7 @@ None.
|
||||||
| :------------ | :--------------- | :------- | :---------------------------------------- | ------------------------------------------------ | ------------------------------------------------- |
|
| :------------ | :--------------- | :------- | :---------------------------------------- | ------------------------------------------------ | ------------------------------------------------- |
|
||||||
| ref | <code>let</code> | Yes | <code>null | HTMLInputElement</code> | <code>null</code> | Obtain a reference to the input HTML element |
|
| ref | <code>let</code> | Yes | <code>null | HTMLInputElement</code> | <code>null</code> | Obtain a reference to the input HTML element |
|
||||||
| checked | <code>let</code> | Yes | <code>boolean</code> | <code>false</code> | Specify whether the checkbox is checked |
|
| checked | <code>let</code> | Yes | <code>boolean</code> | <code>false</code> | Specify whether the checkbox is checked |
|
||||||
|
| value | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the value of the checkbox |
|
||||||
| indeterminate | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Specify whether the checkbox is indeterminate |
|
| indeterminate | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Specify whether the checkbox is indeterminate |
|
||||||
| skeleton | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to display the skeleton state |
|
| skeleton | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to display the skeleton state |
|
||||||
| readonly | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` for the checkbox to be read-only |
|
| readonly | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` for the checkbox to be read-only |
|
||||||
|
|
|
@ -708,6 +708,17 @@
|
||||||
"moduleName": "Checkbox",
|
"moduleName": "Checkbox",
|
||||||
"filePath": "src/Checkbox/Checkbox.svelte",
|
"filePath": "src/Checkbox/Checkbox.svelte",
|
||||||
"props": [
|
"props": [
|
||||||
|
{
|
||||||
|
"name": "value",
|
||||||
|
"kind": "let",
|
||||||
|
"description": "Specify the value of the checkbox",
|
||||||
|
"type": "string",
|
||||||
|
"value": "\"\"",
|
||||||
|
"isFunction": false,
|
||||||
|
"isFunctionDeclaration": false,
|
||||||
|
"constant": false,
|
||||||
|
"reactive": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "checked",
|
"name": "checked",
|
||||||
"kind": "let",
|
"kind": "let",
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
* @event {boolean} check
|
* @event {boolean} check
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** Specify the value of the checkbox */
|
||||||
|
export let value = "";
|
||||||
|
|
||||||
/** Specify whether the checkbox is checked */
|
/** Specify whether the checkbox is checked */
|
||||||
export let checked = false;
|
export let checked = false;
|
||||||
|
|
||||||
|
@ -69,6 +72,7 @@
|
||||||
<input
|
<input
|
||||||
bind:this="{ref}"
|
bind:this="{ref}"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
value="{value}"
|
||||||
checked="{checked}"
|
checked="{checked}"
|
||||||
disabled="{disabled}"
|
disabled="{disabled}"
|
||||||
id="{id}"
|
id="{id}"
|
||||||
|
|
6
types/Checkbox/Checkbox.d.ts
vendored
6
types/Checkbox/Checkbox.d.ts
vendored
|
@ -2,6 +2,12 @@
|
||||||
import { SvelteComponentTyped } from "svelte";
|
import { SvelteComponentTyped } from "svelte";
|
||||||
|
|
||||||
export interface CheckboxProps {
|
export interface CheckboxProps {
|
||||||
|
/**
|
||||||
|
* Specify the value of the checkbox
|
||||||
|
* @default ""
|
||||||
|
*/
|
||||||
|
value?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify whether the checkbox is checked
|
* Specify whether the checkbox is checked
|
||||||
* @default false
|
* @default false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue