UNPKG

@neo4j-ndl/react

Version:

React implementation of Neo4j Design System

52 lines 2.37 kB
/** * * Copyright (c) "Neo4j" * Neo4j Sweden AB [http://neo4j.com] * * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import { type CommonProps, type HtmlAttributes } from '../_common/types'; type SwitchProps = { /** Whether the switch is checked */ isChecked?: boolean; /** Checks the input by default in uncontrolled mode */ isDefaultChecked?: boolean; /** Whether the switch is indeterminate */ isIndeterminate?: boolean; /** Whether the switch is disabled */ isDisabled?: boolean; /** Whether the switch & label should take the full available width of its container */ isFluid?: boolean; /** The value of the switch */ value?: HtmlAttributes<'input'>['value']; /** Whether the label should be displayed before the switch */ hasLeadingLabel?: boolean; /** The callback function triggered when the switch value changes */ onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void; /** The callback function triggered when the switch is clicked */ onClick?: (event: React.MouseEvent<HTMLInputElement>) => void; } & ({ /** The aria label of the switch. Required if the label is not a string. */ ariaLabel: string; /** The label of the switch. If not a string, supply an aria label for screen reader support. */ label?: undefined; } | { ariaLabel?: string; label: React.ReactNode; }); export declare const Switch: ({ isChecked, isDefaultChecked, isIndeterminate, isFluid, isDisabled, hasLeadingLabel, ariaLabel, onChange, onClick, value, label, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"input", SwitchProps>) => import("react/jsx-runtime").JSX.Element; export {}; //# sourceMappingURL=Switch.d.ts.map