Skip to content

Commit 49e119d

Browse files
committed
fix: added review changes
1 parent a3f016b commit 49e119d

File tree

1 file changed

+43
-19
lines changed

1 file changed

+43
-19
lines changed

apps/portal/src/content/docs/components/search-box.mdx

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
---
2-
title: Search Box
3-
description: Search Box component documentation
2+
title: SearchBox
3+
description: SearchBox component documentation
44
---
55

6-
The Search Box component provides a UI element for entering search queries. It includes optional features like search icon, keyboard shortcuts, and custom content.
6+
The `SearchBox` component provides a UI element for entering search queries. It includes optional features like search icon, keyboard shortcuts, and custom content.
77

88
import { DocsPage } from "@/components/docs-page";
99

1010
<DocsPage.ComponentExample
1111
client:only
1212
code={`<SearchBox.Root
13-
placeholder="Search..."
14-
hasSearchIcon={true}
15-
hasShortcut={true}
16-
shortcutLetter="K"
17-
shortcutModifier="alt"
18-
width="fixed"
19-
textSize="text-sm"
20-
showOnFocus={false}
13+
placeholder="Search..."
14+
hasSearchIcon={true}
15+
hasShortcut={true}
16+
shortcutLetter="K"
17+
shortcutModifier="alt"
18+
width="fixed"
19+
textSize="text-sm"
20+
showOnFocus={false}
2121
/>
2222
`}
2323
/>
@@ -29,19 +29,43 @@ import { SearchBox } from '@harnessio/ui/components'
2929

3030
return (
3131
<SearchBox.Root
32-
placeholder="Search..." // [REQUIRED] Placeholder text
33-
hasSearchIcon={true} // [OPTIONAL] Show search icon
34-
hasShortcut={true} // [OPTIONAL] Enable keyboard shortcut
35-
shortcutLetter="K" // [OPTIONAL] Shortcut key
36-
shortcutModifier="cmd" // [OPTIONAL] Modifier key (alt/cmd/ctrl)
37-
onSearch={() => handleSearch()} // [OPTIONAL] Search handler
38-
handleChange={e => onChange(e)} // [OPTIONAL] Input change handler
39-
className="custom-class" // [OPTIONAL] Container styles
32+
placeholder="Search..."
33+
hasSearchIcon={true}
34+
hasShortcut={true}
35+
shortcutLetter="K"
36+
shortcutModifier="cmd"
37+
onSearch={() => handleSearch()}
38+
handleChange={e => onChange(e)}
39+
className="custom-class"
4040
/>
4141
)
4242

4343
## API Reference
4444

45+
### `Root`
46+
47+
The root component that provides search functionality.
48+
49+
```typescript jsx
50+
<SearchBox.Root
51+
width="fixed" // [Optional] Width of the search box ('full' | 'fixed')
52+
hasShortcut={true} // [Optional] Show keyboard shortcut indicator
53+
hasSearchIcon={true} // [Optional] Show search icon
54+
shortcutLetter="k" // [Optional] Keyboard shortcut key
55+
shortcutModifier="cmd" // [Optional] Keyboard shortcut modifier ('cmd' | 'ctrl' | 'alt' | 'shift')
56+
textSize={TextSize['text-sm']} // [Optional] Text size of the input
57+
onSearch={() => searchHandler()} // [Optional] Callback when search is triggered
58+
onFocus={() => focusHandler()} // [Optional] Callback when input is focused
59+
handleChange={e => handleChange(e)} // [Optional] Callback when input value changes
60+
showOnFocus={false} // [Optional] Trigger search on focus
61+
inputClassName="h-8" // [Optional] Additional classes for the input
62+
placeholder="Search..." // [Optional] Placeholder text
63+
value="" // [Optional] Controlled input value
64+
defaultValue="" // [Optional] Default input value
65+
theme="default" // [Optional] Theme variant
66+
/>
67+
```
68+
4569
<DocsPage.PropsTable
4670
props={[
4771
{

0 commit comments

Comments
 (0)