@devseed-ui/form
Version:
devseed UI Kit Form
63 lines (52 loc) • 1.32 kB
TypeScript
import { DefaultTheme, StyledComponent } from 'styled-components';
declare module '@devseed-ui/form' {
export interface formSwitchProps {
/**
* Name to be used as `name` prop of the element.
* (html prop)
*/
name: string;
/**
* id to be used as `id` prop of the element.
* (html prop)
*/
id: string;
/**
* Label's title attribute.
*/
title?: string;
/**
* Whether or not the FormSwitch is checked.
*/
checked?: boolean;
/**
* Change callback for the FormSwitch
*/
onChange: (e: React.SyntheticEvent) => void;
/**
* Value for the underlying checkbox
*/
value: string | number;
/**
* Content for the FormSwitch's label.
*/
children: React.ReactNode;
/**
* Where to position the text.
* @default "left"
*/
textPlacement?: 'left' | 'right';
/**
* Whether or not to hide the FormSwitch's label.
*/
hideText?: boolean;
}
/**
* Displays a Switch element. Looks like a toggle and should be used for
* on/off situations.
* Uses a checkbox under the hood.
*
* @param {formSwitchProps} props Props for the FormSwitch.
*/
export const FormSwitch: StyledComponent<'label', DefaultTheme, formSwitchProps, never>
}