@@ -12,6 +12,7 @@ import "../assets/search-bar.css";
12
12
13
13
export type SearchBarProps = {
14
14
className ?: string ;
15
+ defaultValue ?: string ;
15
16
id ?: string ;
16
17
/** Default: "Rechercher" (or translation) */
17
18
label ?: string ;
@@ -25,6 +26,7 @@ export type SearchBarProps = {
25
26
* the others params can, but it's not mandatory.
26
27
**/
27
28
params : {
29
+ defaultValue ?: string ;
28
30
id : string ;
29
31
type : "search" ;
30
32
className : string ;
@@ -45,13 +47,20 @@ export const SearchBar = memo(
45
47
forwardRef < HTMLDivElement , SearchBarProps > ( ( props , ref ) => {
46
48
const {
47
49
className,
50
+ defaultValue,
48
51
id : id_props ,
49
52
label : label_props ,
50
53
big = false ,
51
54
classes = { } ,
52
55
style,
53
- renderInput = ( { className, id, placeholder, type } ) => (
54
- < input className = { className } id = { id } placeholder = { placeholder } type = { type } />
56
+ renderInput = ( { className, defaultValue, id, placeholder, type } ) => (
57
+ < input
58
+ className = { className }
59
+ defaultValue = { defaultValue }
60
+ id = { id }
61
+ placeholder = { placeholder }
62
+ type = { type }
63
+ />
55
64
) ,
56
65
clearInputOnSearch = false ,
57
66
allowEmptySearch = false ,
@@ -92,6 +101,7 @@ export const SearchBar = memo(
92
101
one time and only one time in each render to allow useState to be used inline*/ }
93
102
{ renderInput ( {
94
103
"className" : fr . cx ( "fr-input" ) ,
104
+ "defaultValue" : defaultValue ,
95
105
"placeholder" : label ,
96
106
"type" : "search" ,
97
107
"id" : inputId
0 commit comments