diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index 07189306..7bbf2e57 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -4151,6 +4151,7 @@ None. | expanded | let | Yes | boolean | false | Set to `true` to expand the search bar | | value | let | Yes | number | string | "" | Specify the value of the search input | | persistent | let | No | boolean | false | Set to `true` to keep the search bar expanded | +| disabled | let | No | boolean | false | Set to `true` to disable the search bar | | tabindex | let | No | string | "0" | Specify the tabindex | ### Slots diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json index 91b47b5a..78077440 100644 --- a/docs/src/COMPONENT_API.json +++ b/docs/src/COMPONENT_API.json @@ -3069,6 +3069,16 @@ "constant": false, "reactive": false }, + { + "name": "disabled", + "kind": "let", + "description": "Set to `true` to disable the search bar", + "type": "boolean", + "value": "false", + "isFunction": false, + "constant": false, + "reactive": false + }, { "name": "tabindex", "kind": "let", diff --git a/src/DataTable/ToolbarSearch.svelte b/src/DataTable/ToolbarSearch.svelte index c19a5961..482d51e8 100644 --- a/src/DataTable/ToolbarSearch.svelte +++ b/src/DataTable/ToolbarSearch.svelte @@ -11,6 +11,9 @@ /** Set to `true` to keep the search bar expanded */ export let persistent = false; + /** Set to `true` to disable the search bar */ + export let disabled = false; + /** Specify the tabindex */ export let tabindex = "0"; @@ -21,10 +24,10 @@ export let ref = null; import { tick } from "svelte"; - import { Search } from "../Search"; + import Search from "../Search/Search.svelte"; async function expandSearch() { - if (persistent || expanded) return; + if (disabled || persistent || expanded) return; expanded = true; await tick(); ref.focus(); @@ -32,17 +35,19 @@