Skip to main content

Attributes

The <bonsai-search> web component accepts the following attributes to customize its appearance and behavior:

Reference Table

AttributeRequiredDefaultNotes
api-keyYesRequired for all requests
base-urlNohttps://api.hibonsai.com/rest/search/v3/API base URL
placeholderNo"Describe what you're looking for..."Input placeholder
suggestionsNo[]JSON array string
max-resultsNo50Max results rendered
timeout-msNo30000Request timeout
render-priceNofalseShows prices
render-price-with-titleNotruePrice shown with title
markdownNofalseEnables markdown rendering
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
featured-items-labelNo"Featured Items"Header for recommendations
more-items-labelNo"More Items"Header when recommendations exist
items-labelNo"Items"Header when no recommendations

Required Attributes

api-key
required
Your Bonsai API key. Required for the search component to function.
<bonsai-search api-key="YOUR_API_KEY_HERE"></bonsai-search>

API Configuration

base-url
default:"https://api.hibonsai.com/rest/search/v3/"
The base URL for the Bonsai Search API.
<bonsai-search base-url="https://api.hibonsai.com/rest/search/v3/"></bonsai-search>

User Experience

placeholder
default:"Describe what you're looking for..."
The placeholder text displayed in the search input field before the user starts typing.
<bonsai-search placeholder="Search our products..."></bonsai-search>
suggestions
default:"[]"
A JSON array of suggested search queries that appear below the search input. These help guide users to common questions or searches.
<bonsai-search suggestions='["Which product is best for my space?", "What features does this product have?"]'></bonsai-search>
The suggestions attribute must be a valid JSON array string. Use single quotes around the attribute value and double quotes for the array items.
max-results
default:"50"
The maximum number of search results to display.
<bonsai-search max-results="20"></bonsai-search>
timeout-ms
default:"30000"
The request timeout in milliseconds.
<bonsai-search timeout-ms="30000"></bonsai-search>

Display Options

render-price
default:"false"
A boolean attribute that enables price display in search results. When present, prices will be shown alongside product information.
<bonsai-search render-price></bonsai-search>
render-price-with-title
default:"true"
A boolean attribute that controls whether the price is displayed with the product title.
<bonsai-search render-price-with-title="false"></bonsai-search>
markdown
Enables markdown rendering in AI summaries and content.
<bonsai-search markdown></bonsai-search>
theme
default:"light"
Color theme for the component. Options: light, dark, or auto.
<bonsai-search theme="dark"></bonsai-search>
results-columns
default:"3"
Number of columns in the results grid layout.
<bonsai-search results-columns="4"></bonsai-search>
image-object-fit
default:"cover"
CSS object-fit value for product images. Options: cover or contain.
<bonsai-search image-object-fit="contain"></bonsai-search>

Results Section Labels

The heading text displayed above AI-recommended products.
<bonsai-search featured-items-label="Top Picks"></bonsai-search>
more-items-label
default:"More Items"
The heading text displayed above additional results when AI recommendations are present.
<bonsai-search more-items-label="See Also"></bonsai-search>
items-label
default:"Items"
The heading text displayed above results when there are no AI recommendations.
<bonsai-search items-label="Products"></bonsai-search>

Color Customization

For more granular color control, use CSS custom properties. See the Advanced Styling guide for the complete list of CSS variables.
brand-color
default:"#0A5B3B"
Primary accent color used throughout the component.
<bonsai-search brand-color="#0A5B3B"></bonsai-search>
text-color
default:"#303030"
Primary text color for content.
<bonsai-search text-color="#303030"></bonsai-search>
muted-color
default:"#9CA3AF"
Secondary text color for less prominent content.
<bonsai-search muted-color="#9CA3AF"></bonsai-search>
input-text-color
default:"text-color"
Text color for input field and icons. Inherits from text-color if not specified.
<bonsai-search input-text-color="#000000"></bonsai-search>
suggestions-text-color
default:"input-text-color"
Text color for suggestion items. Inherits from input-text-color if not specified.
<bonsai-search suggestions-text-color="#666666"></bonsai-search>
suggestions-hover-bg
default:"rgba(0, 0, 0, 0.04)"
Background color when hovering over suggestion items.
<bonsai-search suggestions-hover-bg="rgba(0, 0, 0, 0.06)"></bonsai-search>
results-text-color
default:"text-color"
Text color for summary and section headers. Inherits from text-color if not specified.
<bonsai-search results-text-color="#1a1a1a"></bonsai-search>
card-text-color
default:"text-color"
Text color for result card content. Inherits from text-color if not specified.
<bonsai-search card-text-color="#2a2a2a"></bonsai-search>
input-bg
default:"#f5f5f5"
Background color for input field and dropdown areas.
<bonsai-search input-bg="#f5f5f5"></bonsai-search>
card-bg
default:"input-bg"
Background color for result cards. Inherits from input-bg if not specified.
<bonsai-search card-bg="#ffffff"></bonsai-search>
surface-color
default:"#ffffff"
Background color for elevated surfaces within the component.
<bonsai-search surface-color="#ffffff"></bonsai-search>
canvas-color
default:"#fafafa"
Background color for the main canvas area.
<bonsai-search canvas-color="#fafafa"></bonsai-search>