@@ -10,7 +10,9 @@ import {
1010import { ContainerShape , ControlSize , useTheme } from '../../theme' ;
1111import { isControlSize } from '../../utils/ControlSize' ;
1212import { getOverrides , WithOverrides } from '../../utils/Overrides' ;
13+ import { OptionalString } from '../../utils/types' ;
1314import { Icon } from '../Icon' ;
15+ import { Label , LabelPosition , LabelProps } from '../Typography' ;
1416
1517interface CheckboxBaseProps {
1618 /**
@@ -25,6 +27,17 @@ interface CheckboxBaseProps {
2527 */
2628 value : boolean ;
2729
30+ /**
31+ * Label of the field.
32+ */
33+ label ?: OptionalString ;
34+
35+ /**
36+ * Position of the field.
37+ * @default "right"
38+ */
39+ labelPosition ?: LabelPosition ;
40+
2841 /**
2942 * When true, the checkbox is disabled.
3043 * @default false
@@ -48,6 +61,7 @@ interface CheckboxBaseProps {
4861
4962export interface CheckboxOverrides {
5063 Touchable : TouchableProps ;
64+ Label : LabelProps ;
5165 Check : CheckProps ;
5266}
5367
@@ -59,6 +73,8 @@ export const Checkbox = (props: CheckboxProps) => {
5973 size = 'medium' ,
6074 shape = 'rounded' ,
6175 value = false ,
76+ label,
77+ labelPosition = 'right' ,
6278 isDisabled = false ,
6379 onValueChange = ( ) => {
6480 return ;
@@ -91,13 +107,15 @@ export const Checkbox = (props: CheckboxProps) => {
91107
92108 return (
93109 < Touchable { ...touchableProps } >
94- < Check
95- value = { value }
96- size = { size }
97- shape = { shape }
98- isDisabled = { isDisabled }
99- { ...checkProps }
100- />
110+ < Label label = { label } position = { labelPosition } >
111+ < Check
112+ value = { value }
113+ size = { size }
114+ shape = { shape }
115+ isDisabled = { isDisabled }
116+ { ...checkProps }
117+ />
118+ </ Label >
101119 </ Touchable >
102120 ) ;
103121} ;
0 commit comments