Skip to content

Commit 6b2279f

Browse files
Merge pull request #13 from raskyer/patch-1
Add "emptyPlaceholder" for internationalization
2 parents 7bc9d32 + 3033647 commit 6b2279f

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/select.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ interface CommonProps {
2828
readonly?: boolean;
2929
loading?: boolean;
3030
loadingPlaceholder?: string;
31+
emptyPlaceholder?: string;
3132
}
3233

3334
type SelectReturn = ReturnType<typeof createSelect>;
@@ -43,6 +44,7 @@ const Select = (props: SelectProps) => {
4344
readonly: typeof props.options !== "function",
4445
loading: false,
4546
loadingPlaceholder: "Loading...",
47+
emptyPlaceholder: "No options",
4648
},
4749
props
4850
),
@@ -87,6 +89,7 @@ const Select = (props: SelectProps) => {
8789
options={select.options}
8890
loading={local.loading}
8991
loadingPlaceholder={local.loadingPlaceholder}
92+
emptyPlaceholder={local.emptyPlaceholder}
9093
>
9194
{(option: OptionType) => (
9295
<Option
@@ -236,7 +239,7 @@ type ListProps = {
236239
ref: SelectReturn["listRef"];
237240
children: (option: OptionType) => JSXElement;
238241
} & Pick<SelectReturn, "isOpen" | "options"> &
239-
Pick<CommonProps, "loading" | "loadingPlaceholder">;
242+
Pick<CommonProps, "loading" | "loadingPlaceholder" | "emptyPlaceholder">;
240243

241244
const List = (props: ListProps) => {
242245
return (
@@ -253,7 +256,7 @@ const List = (props: ListProps) => {
253256
<For
254257
each={props.options}
255258
fallback={
256-
<div class="solid-select-list-placeholder">No options</div>
259+
<div class="solid-select-list-placeholder">{props.emptyPlaceholder}</div>
257260
}
258261
>
259262
{props.children}

0 commit comments

Comments
 (0)