mirror of
https://github.com/devonthesofa/obsidian-note-status.git
synced 2026-07-22 12:30:24 +00:00
feat: add simple select component
This commit is contained in:
parent
1cfa85db8f
commit
b412698403
1 changed files with 26 additions and 0 deletions
26
components/atoms/Select.tsx
Normal file
26
components/atoms/Select.tsx
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import React, { ReactNode } from "react";
|
||||
|
||||
type SelectProps = {
|
||||
options: { value: string | number; display: ReactNode }[];
|
||||
onChange: (value: string) => void;
|
||||
defaultValue?: string;
|
||||
};
|
||||
|
||||
export const Select: React.FC<SelectProps> = ({
|
||||
options,
|
||||
onChange,
|
||||
defaultValue,
|
||||
}) => {
|
||||
return (
|
||||
<select
|
||||
defaultValue={defaultValue}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
>
|
||||
{options.map((option) => (
|
||||
<option key={option.value} value={option.value}>
|
||||
{option.display}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
);
|
||||
};
|
||||
Loading…
Reference in a new issue