Skip to content

Commit

Permalink
feat: add required option to selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
ArmanNik committed Nov 26, 2024
1 parent 9cff1a0 commit e26e5da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion v2/pink-sb/src/lib/selector/Checkbox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
export let size: 's' | 'm' = 'm';
export let label: string | undefined = undefined;
export let checked: boolean | 'indeterminate' = false;
export let required: boolean = false;
const dispatch = createEventDispatcher();
Expand Down Expand Up @@ -43,7 +44,7 @@
<Icon icon={IconCheck} size="s" --icon-color="white" />
{/if}
</button>
<input {...$input} use:input />
<input {...$input} use:input {required} />
</Base>

<style lang="scss">
Expand Down
3 changes: 2 additions & 1 deletion v2/pink-sb/src/lib/selector/Switch.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
export let id: string | undefined = undefined;
export let name: string | undefined = undefined;
export let label: string | undefined = undefined;
export let required: boolean = false;
const dispatch = createEventDispatcher();
Expand All @@ -29,7 +30,7 @@
<Base {label} {id}>
<button {...$root} use:root {disabled}>
<span class="thumb" />
<input {...$input} use:input on:invalid on:change {id} />
<input {...$input} use:input on:invalid on:change {id} {required} />
</button>
</Base>

Expand Down

0 comments on commit e26e5da

Please sign in to comment.