@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
@chakra-ui/react#DrawerFooter TypeScript Examples
The following examples show how to use
@chakra-ui/react#DrawerFooter.
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: index.tsx From calories-in with MIT License | 4 votes |
function Content({
onClose,
mealName,
mealForm,
searchInputRef,
onSelectedFoods,
canSelect,
}: Props) {
const selection = useSelection<Food>()
const listRef = useRef<FoodsListMethods>(null)
const foodEvents = useFoodEvents({ listRef, selection })
const foodsListModalDisclosure = useDisclosure()
const importFoods = useImportFoods({ foodsListModalDisclosure })
const [foodsFilter] = useState(loadFoodsFilter)
function onAdd() {
onSelectedFoods && onSelectedFoods(selection.selectedItems, mealName)
}
return (
<DrawerContent>
<DrawerCloseButton />
<Header mealForm={mealForm} mealName={mealName} canSelect={canSelect} />
<DrawerBody overflow="hidden">
<VStack
width="100%"
height="100%"
spacing={canSelect ? 3 : 6}
alignItems="stretch"
>
<Flex>
<Text textColor="gray.500" size="lg" mr={1}>
Need more foods?
</Text>
<Button
variant="link"
colorScheme="teal"
onClick={foodEvents.onCreateFood}
>
Create a new food
</Button>
</Flex>
{canSelect && <SelectedFoodsList selection={selection} />}
<FoodsFilterStoreProvider initialFilter={foodsFilter}>
<FoodsList
ref={listRef}
searchInputRef={searchInputRef}
selection={selection}
flex={1}
onFoodPreview={foodEvents.onPreviewFood}
itemUsageType={canSelect ? 'selectOrPreview' : 'previewOnly'}
/>
</FoodsFilterStoreProvider>
</VStack>
</DrawerBody>
<DrawerFooter justifyContent={canSelect ? 'flex-end' : 'space-between'}>
{!canSelect && (
<MenuButtons
onImport={importFoods.onImport}
onExport={foodsListModalDisclosure.onOpen}
/>
)}
<HStack spacing={3}>
<Button variant="solid" size="md" onClick={onClose}>
Close
</Button>
{canSelect && (
<Tooltip
isActive={!mealForm}
delay={300}
label="You can add more later"
>
<Button
isDisabled={selection.selectedItems.length === 0}
colorScheme="teal"
onClick={onAdd}
>
{mealForm ? 'Add selected foods' : 'Select foods'}
</Button>
</Tooltip>
)}
</HStack>
</DrawerFooter>
<FoodModal
isOpen={foodEvents.foodModalDisclosure.isOpen}
onClose={foodEvents.foodModalDisclosure.onClose}
onFoodCreatedOrUpdated={foodEvents.onFoodCreatedOrUpdated}
onFoodDeleted={foodEvents.onFoodDeleted}
food={foodEvents.food}
/>
<FoodsListModal
isOpen={foodsListModalDisclosure.isOpen}
onClose={foodsListModalDisclosure.onClose}
foodsToImport={importFoods.foodsToImport}
/>
</DrawerContent>
)
}