Files
Homarr/packages/widgets/src/_inputs/widget-switch-input.tsx
Meier Lukas b78d32b81c fix: nextjs is slow dev server (#364)
* fix: nextjs slow compile time

* fix: change optimized package imports and transpile packages

* fix: format issue
2024-04-25 22:06:15 +02:00

25 lines
619 B
TypeScript

"use client";
import { Switch } from "@mantine/core";
import type { CommonWidgetInputProps } from "./common";
import { useWidgetInputTranslation } from "./common";
import { useFormContext } from "./form";
export const WidgetSwitchInput = ({
property,
kind,
options,
}: CommonWidgetInputProps<"switch">) => {
const t = useWidgetInputTranslation(kind, property);
const form = useFormContext();
return (
<Switch
label={t("label")}
description={options.withDescription ? t("description") : undefined}
{...form.getInputProps(`options.${property}`, { type: "checkbox" })}
/>
);
};