-
Notifications
You must be signed in to change notification settings - Fork 4k
Expand file tree
/
Copy pathCheckbox.d.ts
More file actions
126 lines (101 loc) · 3.42 KB
/
Checkbox.d.ts
File metadata and controls
126 lines (101 loc) · 3.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import * as React from 'react'
import { ForwardRefComponent, HtmlLabelProps, SemanticShorthandItem } from '../../generic'
export interface CheckboxProps extends StrictCheckboxProps {
[key: string]: any
}
export interface StrictCheckboxProps {
/** An element type to render as (string or function). */
as?: any
/** Whether or not checkbox is checked. */
checked?: boolean
/** Additional classes. */
className?: string
/** The initial value of checked. */
defaultChecked?: boolean
/** Whether or not checkbox is indeterminate. */
defaultIndeterminate?: boolean
/** A checkbox can appear disabled and be unable to change states */
disabled?: boolean
/** Removes padding for a label. Auto applied when there is no label. */
fitted?: boolean
/** A unique identifier. */
id?: number | string
/** Whether or not checkbox is indeterminate. */
indeterminate?: boolean
/** The text of the associated label element. */
label?: SemanticShorthandItem<HtmlLabelProps>
/** The HTML input name. */
name?: string
/**
* Called when the user attempts to change the checked state.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} props - All props.
* @param {boolean} checked - Current checked state.
* @param {boolean} indeterminate - Current indeterminate state.
*/
onChange?: (
event: React.FormEvent<HTMLInputElement>,
props: CheckboxProps,
checked: boolean,
indeterminate: boolean,
) => void
/**
* Called when the checkbox or label is clicked.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} props - All props.
* @param {boolean} checked - Current checked state.
* @param {boolean} indeterminate - Current indeterminate state.
*/
onClick?: (
event: React.MouseEvent<HTMLInputElement>,
props: CheckboxProps,
checked: boolean,
indeterminate: boolean,
) => void
/**
* Called when the user presses down on the mouse.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} props - All props.
* @param {boolean} checked - Current checked state.
* @param {boolean} indeterminate - Current indeterminate state.
*/
onMouseDown?: (
event: React.MouseEvent<HTMLInputElement>,
props: CheckboxProps,
checked: boolean,
indeterminate: boolean,
) => void
/**
* Called when the user releases the mouse.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} props - All props.
* @param {boolean} checked - Current checked state.
* @param {boolean} indeterminate - Current indeterminate state.
*/
onMouseUp?: (
event: React.MouseEvent<HTMLInputElement>,
props: CheckboxProps,
checked: boolean,
indeterminate: boolean,
) => void
/** Format as a radio element. This means it is an exclusive option. */
radio?: boolean
/** A checkbox can be read-only and unable to change states. */
readOnly?: boolean
/** Format to emphasize the current selection state. */
slider?: boolean
/** A checkbox can receive focus. */
tabIndex?: number | string
/** Format to show an on or off choice. */
toggle?: boolean
/** HTML input type, either checkbox or radio. */
type?: 'checkbox' | 'radio'
/** The HTML input value. */
value?: number | string
}
declare const Checkbox: ForwardRefComponent<CheckboxProps, HTMLDivElement>
export default Checkbox