Search Field
BsSearchField is a component that let users enter search keyword into an UI.
Overview
BsSearchField is standalone input field component that let users enter search keywords. This component is usually placed on the Navbar or anywhere on a page that is easy to see.
BsSearchField mimics the HTML5 <input>
element. This means that you can add attributes like readonly
, or disabled
and it will react to them to give the best experience. You can also use v-model
directive to create two-way data bindings on the model-value
property. Additionally, you can listen to the search
event to handle the search task based on the given keyword.
IMPORTANT
Do not use the model-value
property when using v-model
.
Dark Mode
You can configure <bs-search-field>
to adapts to the container background color by explicitly define the dark-mode
property.
Custom Search
<bs-search-field>
component can also be used to build custom search by explicitly define the advance-search
property. Then use the popover
slot to build a custom form elements for the custom search. <bs-search-field>
uses BsPopover internally to handle the custom form elements.
CSS Variables
Added since v2.0.0--bs-searchbox-bg: #{rgba($black, .015)};
--bs-searchbox-active-bg: #fff;
--bs-searchbox-border-color: #{rgba($black, .07)};
--bs-searchbox-border-width: thin;
--bs-searchbox-active-border-color: rgb(var(--md-field-primary-indicator-rgb));
--bs-searchbox-focused-shadow-rgba: rgba(var(--md-field-primary-indicator-rgb), 0.25);
--bs-searchbox-padding-x: .375rem;
--bs-searchbox-padding-y: .375rem;
--bs-searchbox-text-color: currentColor;