Files
Homarr/packages/widgets/src/_inputs/widget-switch-input.tsx
Thomas Camlong f1b1ec59ec chore: update prettier configuration for print width (#519)
* feat: update prettier configuration for print width

* chore: apply code formatting to entire repository

* fix: remove build files

* fix: format issue

---------

Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
2024-05-19 22:38:39 +02:00

21 lines
612 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" })}
/>
);
};