@@ -12,6 +12,7 @@ import "../assets/search-bar.css";
1212
1313export type SearchBarProps = {
1414 className ?: string ;
15+ defaultValue ?: string ;
1516 id ?: string ;
1617 /** Default: "Rechercher" (or translation) */
1718 label ?: string ;
@@ -25,6 +26,7 @@ export type SearchBarProps = {
2526 * the others params can, but it's not mandatory.
2627 **/
2728 params : {
29+ defaultValue ?: string ;
2830 id : string ;
2931 type : "search" ;
3032 className : string ;
@@ -45,13 +47,20 @@ export const SearchBar = memo(
4547 forwardRef < HTMLDivElement , SearchBarProps > ( ( props , ref ) => {
4648 const {
4749 className,
50+ defaultValue,
4851 id : id_props ,
4952 label : label_props ,
5053 big = false ,
5154 classes = { } ,
5255 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+ />
5564 ) ,
5665 clearInputOnSearch = false ,
5766 allowEmptySearch = false ,
@@ -92,6 +101,7 @@ export const SearchBar = memo(
92101 one time and only one time in each render to allow useState to be used inline*/ }
93102 { renderInput ( {
94103 "className" : fr . cx ( "fr-input" ) ,
104+ "defaultValue" : defaultValue ,
95105 "placeholder" : label ,
96106 "type" : "search" ,
97107 "id" : inputId
0 commit comments