Skip to main content

Check List

FlexNative Checkbox is part of the @flexnative/inputs package. To use the FlexNative Checkbox you needs to install @flexnative/inputs package. Fallow this link on how to install the package.

API

import { CheckList, CheckListProps } from '@flexnative/inputs';

Component

CheckList

Type: React.PureComponent<CheckListProps<T>>

Properties

NameTypeRequiredDefault ValueDescription
valueT ❘ Array<T>falseundefinedRepresenting selected value/values from the available list.
valueFieldstringfalseundefinedWhen the selected item is an object, always specify valueField. If you do not set a value for the field, the list will compare the items by reference, which may complicate debugging. For example, the selected value will not be applied, if it does not reference the exact passed data object.
typeInputTypefalseoutlinedChecklist borders mode.
multipleSelectbooleanfalsetrueBoolean value for single or multiple selection.
sizeSizesfalsenormalCheck list sizes.
radiusBorderRadiusfalsemediumCheck list border radius.
borderWidthBorderWidthfalsehairlineCheck list borders width.
borderColorColorValuefalseundefinedBorders color according react-native ColorValue.
disabledbooleanfalsefalseIndicator if input it is disabled or not.
colorInputColorfalsetheme.color.defaultColor by theme or a custom color according react-native ColorValue.
backgroundColorColorValuefalseundefinedInput background color.
labelstring or React.ReactElementfalseundefinedA string value to display as labal, or React.ReactElement to display a custom element as a label.
labelStyleStyleProp<TextStyle> or ((state: StateCallbackType) => StyleProp<TextStyle>)falseundefinedEither text styles or a function that receives a boolean reflecting whether the component is currently active and returns text styles.
onChange(event: NativeSyntheticEvent<CheckboxEvent<T> ❘ SyntheticEvent<HTMLInputElement, <CheckboxEvent<T>>) => void;falseundefinedCallback that is invoked when the user presses the checkbox.
onValueChange(value: T) => voidfalseundefinedCallback that is invoked when the user presses the checkbox.
direction'row' | 'column'falsecolumnCheck element direction.
materialbooleanfalsefalseIndicator if input should looks like Material input.
helperTextstringfalseundefinedHelper text about input.
childrenArray<CheckProps<T>>falseundefinedReact element to render custom check boxes.

InputType

One of 'outlined' | 'underlined'

NameTypeDescription
outlinedstringProperty to set check list with borders.
underlinedstringProperty to set check list underlined, (with only bottom border).

Sizes

One of 'small' | 'default' | 'medium' | 'large'

NameTypeValue
smallstringText size: FONT_SIZE.small
Padding Vertical: FONT_SIZE.small * 0.5
Padding Horizonta: FONT_SIZE.small * 0.75
Helper text size: FONT_SIZE.small * 0.75
Label text size: for material FONT_SIZE.small * 0.78, default FONT_SIZE.small
defaultstringFonts size: FONT_SIZE.default
Icon size: FONT_SIZE.default * 1.5
Padding Horizonta: FONT_SIZE.default * 0.75
Helper text size: FONT_SIZE.default * 0.75
Label text size: for material FONT_SIZE.default * 0.78, default FONT_SIZE.default
mediumstringFonts size: FONT_SIZE.medium
Icon size: FONT_SIZE.medium * 1.5
Padding Horizonta: FONT_SIZE.medium * 0.75
Helper text size: FONT_SIZE.medium * 0.75
Label text size: for material FONT_SIZE.medium * 0.78, default FONT_SIZE.medium
largestringFonts size: FONT_SIZE.large
Icon size: FONT_SIZE.large * 1.5
Padding Horizonta: FONT_SIZE.large * 0.75
Helper text size: FONT_SIZE.large * 0.75
Label text size: for material FONT_SIZE.large * 0.78, default FONT_SIZE.large

BorderRadius

One of 'none' | 'small' | 'medium' | 'large' | 'full' | number

NameTypeValue
nonenumber0
smallnumber2
mediumnumber4
largenumber6
fullnumber99999
numberAny number value.

BorderWidth

One of 'none' | 'hairline' | 'thin' | 'base' | 'thick' | number

NameTypeValue
nonenumber0
hairlineStyleSheet.hairlineWidthThis is defined as the width of a thin line on the platform. It can be used as the thickness of a border or division between two elements.
thinnumber1
basenumber2
thicknumber3
numberAny number value

InputColor

One of 'default' | 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error' | 'dark' | 'light' | ColorValue

Name Type ValuePreview
LightDark
backgroundColorValuetheme.colors.background #f8f8f8 #000000
defaultColorValuetheme.colors.default #f5f5f5 #404040
cardColorValuetheme.colors.card #ffffff #232323
textColorValuetheme.colors.text #424242 #ffffff
borderColorValuetheme.colors.border #42424226 #ffffff1A
placeholderColorValuetheme.colors.placeholder #0000001A #FFFFFF1A
infoColorValuetheme.colors.info #3e80ed #3e80ed
successColorValuetheme.colors.success #5ec232 #5ec232
warningColorValuetheme.colors.warning #ffc107 #ffc107
errorColorValuetheme.colors.error #d51923 #d51923
darkColorValuetheme.colors.dark #424242 #424242
secondaryColorValuetheme.colors.secondary #666666 #5C5C5C
lightColorValuetheme.colors.light #ebebeb #ebebeb
primaryColorValuetheme.colors.primary #ff6358 #ff6358
ColorValueAny ColorValue chosen by developer.

Playground

Live Editor
//Play with props to see live changes;

function CheckListPlayground() {
  const [textValues, setTextValues] = useState(['1', '2', '3']);

  return (
    <CheckList label='Check list label'
              value={textValues}
              color='success'
              size='large'
              backgroundColor='default'
              borderColor='info'
              borderWidth='thick'
              radius='medium'
              onValueChange={(newValues) => setTextValues([...newValues])}>
      <Check value='1' label='Check 1' />
      <Check value='2' label='Check 2' />
      <Check value='3' label='Check 3' color='primary' />
    </CheckList>
  );
}

render(<CheckListPlayground />);
Result
Loading...