Skip to main content

Attributes

The <bonsai-searchbar> web component accepts the following attributes to customize redirect behavior and appearance.

Reference Table

AttributeRequiredDefaultNotes
search-pathNo"/ai-search"Redirect destination
placeholderNo"Describe what you're looking for..."Input placeholder
suggestionsNo[]JSON array string
themeNolightlight, dark, or auto
brand-colorNo#0A5B3BPrimary accent
text-colorNo#303030Primary text
muted-colorNo#9CA3AFSecondary text
input-text-colorNotext-colorInput + icon text
suggestions-text-colorNoinput-text-colorSuggestion text
suggestions-hover-bgNorgba(0, 0, 0, 0.04)Suggestion hover
results-text-colorNotext-colorSummary + headers
card-text-colorNotext-colorResult cards
results-columnsNo3Results grid columns
input-bgNo#f5f5f5Input + dropdown bg
card-bgNoinput-bgCard background
surface-colorNo#ffffffSurfaces
canvas-colorNo#fafafaCanvas background
image-object-fitNocovercover or contain
input-opacityNo1Input background opacity
close-buttonNofalseShows close action

Redirect and UX

search-path
default:"/ai-search"
The path the component redirects to after query submission.
<bonsai-searchbar search-path="/ai-search"></bonsai-searchbar>
placeholder
default:"Describe what you're looking for..."
The placeholder text shown before the user enters a query.
<bonsai-searchbar placeholder="Describe what you're looking for..."></bonsai-searchbar>
suggestions
default:"[]"
A JSON array of suggested queries shown in the dropdown.
<bonsai-searchbar suggestions='["What is your return policy?", "Do you offer gift cards?"]'></bonsai-searchbar>
The suggestions attribute must be valid JSON. Use single quotes around the attribute value and double quotes inside the array.

Theme and colors

For lower-level visual control, use ::part(...) selectors from the Advanced Styling guide.
theme
default:"light"
The default color palette. Options: light, dark, or auto.
<bonsai-searchbar theme="dark"></bonsai-searchbar>
brand-color
default:"#0A5B3B"
Primary accent color for interactive UI elements.
<bonsai-searchbar brand-color="#0A5B3B"></bonsai-searchbar>
text-color
default:"#303030"
Primary text color for component content.
<bonsai-searchbar text-color="#303030"></bonsai-searchbar>
muted-color
default:"#9CA3AF"
Secondary text color for muted content.
<bonsai-searchbar muted-color="#9CA3AF"></bonsai-searchbar>
input-text-color
default:"text-color"
Input text and icon color. Inherits from text-color when not set.
<bonsai-searchbar input-text-color="#111111"></bonsai-searchbar>
suggestions-text-color
default:"input-text-color"
Text color for suggestion rows. Inherits from input-text-color when not set.
<bonsai-searchbar suggestions-text-color="#111111"></bonsai-searchbar>
suggestions-hover-bg
default:"rgba(0, 0, 0, 0.04)"
Background color for suggestion rows on hover.
<bonsai-searchbar suggestions-hover-bg="rgba(0, 0, 0, 0.06)"></bonsai-searchbar>
input-bg
default:"#f5f5f5"
Background color for the search input and suggestions dropdown.
<bonsai-searchbar input-bg="#f5f5f5"></bonsai-searchbar>
card-bg
default:"input-bg"
Background color for card surfaces. Inherits from input-bg if not set.
<bonsai-searchbar card-bg="#ffffff"></bonsai-searchbar>
surface-color
default:"#ffffff"
Background color for surface layers.
<bonsai-searchbar surface-color="#ffffff"></bonsai-searchbar>
canvas-color
default:"#fafafa"
Background color for the surrounding canvas.
<bonsai-searchbar canvas-color="#fafafa"></bonsai-searchbar>

Display controls

results-text-color
default:"text-color"
Text color for summary and section headers.
<bonsai-searchbar results-text-color="#eaeaea"></bonsai-searchbar>
card-text-color
default:"text-color"
Text color used inside result cards.
<bonsai-searchbar card-text-color="#111111"></bonsai-searchbar>
results-columns
default:"3"
Number of columns in the results grid.
<bonsai-searchbar results-columns="2"></bonsai-searchbar>
image-object-fit
default:"cover"
Image sizing mode. Options: cover or contain.
<bonsai-searchbar image-object-fit="contain"></bonsai-searchbar>
input-opacity
default:"1"
Opacity for the input background.
<bonsai-searchbar input-opacity="0.95"></bonsai-searchbar>
close-button
default:"false"
Boolean attribute that enables the close action button when present.
<bonsai-searchbar close-button></bonsai-searchbar>