@chakra-ui/react APIs
- ChakraProvider
- Flex
- Box
- Button
- Text
- Heading
- Input
- Link
- Stack
- IconButton
- HStack
- Center
- FormLabel
- BoxProps
- useDisclosure
- FormControl
- Image
- extendTheme
- VStack
- PopoverContent
- PopoverTrigger
- Icon
- InputGroup
- ListItem
- Popover
- PopoverBody
- Select
- Grid
- Alert
- Modal
- ModalOverlay
- ModalContent
- ButtonGroup
- PopoverArrow
- Checkbox
- Tag
- Badge
- Tooltip
- SimpleGrid
- Textarea
- ModalBody
- useToast
- Avatar
- PopoverCloseButton
- useColorModeValue
- Menu
- MenuButton
- MenuItem
- MenuList
- Divider
- AlertIcon
- ButtonProps
- ModalHeader
- Spinner
- PopoverHeader
- FormErrorMessage
- Table
- Thead
- Tbody
- Tr
- Th
- Td
- useColorMode
- InputLeftElement
- ColorModeScript
- ModalFooter
- TabList
- Tab
- Drawer
- DrawerContent
- FlexProps
- DrawerOverlay
- DrawerBody
- Switch
- Accordion
- AccordionItem
- AccordionButton
- AccordionPanel
- AccordionIcon
- Slider
- SliderTrack
- SliderFilledTrack
- SliderThumb
- LinkProps
- ModalCloseButton
- Tabs
- TabPanels
- TabPanel
- List
- Container
- UnorderedList
- FormHelperText
- Code
- TagLabel
- Spacer
- GridItem
- DrawerHeader
- theme
- IconButtonProps
- DrawerCloseButton
- Portal
- Skeleton
- NumberInput
- NumberInputField
- NumberInputStepper
- NumberIncrementStepper
- NumberDecrementStepper
- Progress
- Radio
- AlertTitle
- InputLeftAddon
- MenuDivider
- Wrap
- chakra
- StackProps
- useClipboard
- RadioGroup
- Collapse
- AlertDescription
- InputProps
- ListIcon
- PopoverFooter
- InputRightElement
- AlertDialog
- AlertDialogOverlay
- AlertDialogBody
- AlertDialogContent
- AlertDialogFooter
- AlertDialogHeader
- TagCloseButton
- CloseButton
- CircularProgress
- WrapItem
- SlideFade
- createStandaloneToast
- localStorageManager
- Fade
- useMediaQuery
- AspectRatio
- AvatarGroup
- SelectProps
- Breadcrumb
- BreadcrumbItem
- TextProps
- useTheme
- OrderedList
- HeadingProps
- useBoolean
- TableCaption
- ColorModeProvider
- Theme
- BreadcrumbLink
- InputRightAddon
- Tfoot
- TagLeftIcon
- useBreakpointValue
- AccordionPanelProps
- UseToastOptions
- cookieStorageManager
- ContainerProps
- IconProps
- ListProps
- keyframes
- SkeletonText
- LinkBox
- LinkOverlay
- SliderMark
- useOutsideClick
- AlertDialogCloseButton
- CSSReset
- ThemeConfig
- Circle
- forwardRef
- useInterval
- useMultiStyleConfig
- StylesProvider
- CheckboxGroup
- usePrevious
- styled
- useStyles
- IToast
- ComponentStyleConfig
- BackgroundProps
- toast
- PinInput
- PinInputField
- Slide
- useUpdateEffect
- DarkMode
- LightMode
- AvatarBadge
- MenuButtonProps
- AccordionItemProps
- ListItemProps
- Img
- createIcon
- ColorMode
- ComponentWithAs
- VisuallyHidden
- Editable
- EditableInput
- EditablePreview
- DrawerFooter
- useMergeRefs
Other Related APIs
- react#useCallback
- react#ReactNode
- react#ReactText
- @chakra-ui/react#Popover
- @chakra-ui/react#PopoverArrow
- @chakra-ui/react#PopoverBody
- @chakra-ui/react#PopoverCloseButton
- @chakra-ui/react#PopoverContent
- @chakra-ui/react#PopoverHeader
- @chakra-ui/react#PopoverTrigger
- @chakra-ui/react#Checkbox
- @chakra-ui/react#Button
- @chakra-ui/react#Portal
@chakra-ui/react#CheckboxGroup TypeScript Examples
The following examples show how to use
@chakra-ui/react#CheckboxGroup.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ColumnsHider.tsx From ke with MIT License | 6 votes |
export function ColumnsHider<T>({ children, onChange, columns, visibleColumns }: ColumnHiderProps<T>): JSX.Element {
const handleChange = useCallback(
(values: ReactText[]) => {
const newVisibleColumns = columns.filter(({ name }) => values.includes(String(name)))
onChange(newVisibleColumns)
},
[onChange, columns]
)
return (
<div>
<Popover placement="right-start">
<PopoverTrigger>
<Button margin="10px 0">Отображаемые колонки</Button>
</PopoverTrigger>
<Portal>
<PopoverContent>
<PopoverArrow />
<PopoverHeader>Выберите отображаемые колонки</PopoverHeader>
<PopoverCloseButton />
<PopoverBody maxHeight="400px" overflow="scroll">
<CheckboxGroup value={visibleColumns.map(({ name }) => name)} onChange={handleChange}>
{columns.map(({ name, header }) => (
<Checkbox value={name} display="block">
{header}
</Checkbox>
))}
</CheckboxGroup>
</PopoverBody>
</PopoverContent>
</Portal>
</Popover>
{children}
</div>
)
}
Example #2
Source File: CheckBoxGroup.tsx From ke with MIT License | 6 votes |
CheckBoxGroupInner = <T extends object>( props: CheckBoxGroupProps<T>, ref?: React.ForwardedRef<HTMLInputElement> ): JSX.Element => { const { value, onChange, getKey, getValue, getLabel, defaultValue } = props const handleChange = useCallback( (changeValues: (string | number)[]): void => { onChange(value.filter((v) => changeValues.includes(getValue(v)))) }, [onChange, getValue, value] ) return ( <div ref={ref}> <CheckboxGroup colorScheme="brand" defaultValue={defaultValue} onChange={(values) => handleChange(values)}> {value.map((v: T) => ( <Checkbox spacing={8} key={getKey(v)} value={getValue(v)} mr={4}> {getLabel(v)} </Checkbox> ))} </CheckboxGroup> </div> ) }