mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 18:31:06 +00:00
feat(search): export autofocus prop
This commit is contained in:
parent
152cbcd1ab
commit
fd91dd80c5
1 changed files with 5 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
||||||
let className = undefined;
|
let className = undefined;
|
||||||
export { className as class };
|
export { className as class };
|
||||||
export let value = '';
|
export let value = '';
|
||||||
|
export let autofocus = false;
|
||||||
export let type = 'text';
|
export let type = 'text';
|
||||||
export let small = false;
|
export let small = false;
|
||||||
export let placeHolderText = '';
|
export let placeHolderText = '';
|
||||||
|
@ -28,6 +29,7 @@
|
||||||
{style}>
|
{style}>
|
||||||
<Search16 class={cx('--search-magnifier')} />
|
<Search16 class={cx('--search-magnifier')} />
|
||||||
<label for={id} class={cx('--label')}>{labelText}</label>
|
<label for={id} class={cx('--label')}>{labelText}</label>
|
||||||
|
<!-- svelte-ignore a11y-autofocus -->
|
||||||
<input
|
<input
|
||||||
bind:this={inputRef}
|
bind:this={inputRef}
|
||||||
role="searchbox"
|
role="searchbox"
|
||||||
|
@ -35,9 +37,10 @@
|
||||||
placeholder={placeHolderText}
|
placeholder={placeHolderText}
|
||||||
on:change
|
on:change
|
||||||
on:input
|
on:input
|
||||||
on:input={event => {
|
on:input={({ target }) => {
|
||||||
value = event.target.value;
|
value = target.value;
|
||||||
}}
|
}}
|
||||||
|
{autofocus}
|
||||||
{type}
|
{type}
|
||||||
{id}
|
{id}
|
||||||
{value} />
|
{value} />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue