mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
chore: add more type docs
This commit is contained in:
parent
773b18d314
commit
c3f924c25a
45 changed files with 517 additions and 50 deletions
|
@ -1,8 +1,32 @@
|
|||
<script>
|
||||
/**
|
||||
* Set to `true` to toggle the checkbox input
|
||||
* @type {boolean} [toggled=false]
|
||||
*/
|
||||
export let toggled = false;
|
||||
|
||||
/**
|
||||
* Set to `true` to disable checkbox input
|
||||
* @type {boolean} [disabled=false]
|
||||
*/
|
||||
export let disabled = false;
|
||||
|
||||
/**
|
||||
* Specify the label for the untoggled state
|
||||
* @type {string} [labelA="Off"]
|
||||
*/
|
||||
export let labelA = "Off";
|
||||
|
||||
/**
|
||||
* Specify the label for the toggled state
|
||||
* @type {string} [labelB="On"]
|
||||
*/
|
||||
export let labelB = "On";
|
||||
|
||||
/**
|
||||
* Specify the label text
|
||||
* @type {string} [labelText=""]
|
||||
*/
|
||||
export let labelText = "";
|
||||
|
||||
/**
|
||||
|
@ -10,6 +34,11 @@
|
|||
* @type {string} [id]
|
||||
*/
|
||||
export let id = "ccs-" + Math.random().toString(36);
|
||||
|
||||
/**
|
||||
* Specify a name attribute for the checkbox input
|
||||
* @type {string} [name]
|
||||
*/
|
||||
export let name = undefined;
|
||||
</script>
|
||||
|
||||
|
@ -33,7 +62,7 @@
|
|||
toggled = !toggled;
|
||||
}}
|
||||
on:keyup
|
||||
on:keyup={e => {
|
||||
on:keyup={(e) => {
|
||||
if (e.key === ' ' || e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
toggled = !toggled;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue