Files
chocoadmin/components/forms/auto-submit-select.tsx
T

21 lines
373 B
TypeScript

"use client";
import type { ComponentProps } from "react";
type AutoSubmitSelectProps = ComponentProps<"select">;
export function AutoSubmitSelect({
onChange,
...props
}: AutoSubmitSelectProps) {
return (
<select
{...props}
onChange={(event) => {
onChange?.(event);
event.currentTarget.form?.requestSubmit();
}}
/>
);
}