Skip to content

Commit 4f9e0ea

Browse files
committed
add(Checkbox): add inputID as prop to Checkbox
1 parent c7f80d7 commit 4f9e0ea

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

components/mdc/Checkbox/Checkbox.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ export let checked = false
1515
export let disabled = false
1616
/** @type {boolean} if the label should be uppercase or not */
1717
export let uppercase = false
18+
/** @type {string} random id prefixed with checkbox- for the input id*/
19+
export let inputID = generateRandomID('checkbox-')
1820
1921
let checkboxElement = {}
2022
let formFieldElement = {}
2123
let checkbox
2224
23-
const inputID = generateRandomID('checkbox-')
24-
2525
$: if (checkbox) checkbox.checked = checked
2626
2727
onMount(() => {

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ declare module '@silintl/ui-components' {
3636
disabled?: boolean
3737
uppercase?: boolean
3838
class?: string
39+
inputID?: string
3940
}
4041
export class Checkbox extends SvelteComponentTyped<CheckboxProps> {}
4142

0 commit comments

Comments
 (0)