@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#AlertDialogCloseButton TypeScript Examples
The following examples show how to use
@chakra-ui/react#AlertDialogCloseButton.
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: Dialog.tsx From wiregui with MIT License | 5 votes |
export function Dialog({
header,
body,
isOpen,
onConfirm,
onCancel,
onClose,
motionPreset = "slideInBottom",
cancelButtonText = "Cancel",
confirmButtonText = "Confirm",
}: DialogProps) {
const cancelRef = React.useRef<HTMLButtonElement>(null);
function onHandleConfirm() {
if (onConfirm) {
onConfirm();
}
if (onClose) {
onClose();
}
}
function onHandleCancel() {
if (onCancel) {
onCancel();
}
if (onClose) {
onClose();
}
}
return (
<>
<AlertDialog
motionPreset={motionPreset}
leastDestructiveRef={cancelRef}
onClose={onClose ? onClose : () => { return; }}
isOpen={isOpen}
isCentered
>
<AlertDialogOverlay />
<AlertDialogContent bg="gray.300">
<AlertDialogHeader>{header}</AlertDialogHeader>
<AlertDialogCloseButton />
<AlertDialogBody>{body}</AlertDialogBody>
<AlertDialogFooter>
<Button ref={cancelRef} onClick={onHandleCancel}>
{cancelButtonText}
</Button>
<Button colorScheme="orange" ml={3} onClick={onHandleConfirm}>
{confirmButtonText}
</Button>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</>
);
}
Example #2
Source File: DialogButton.tsx From wiregui with MIT License | 5 votes |
export function DialogButton({
header,
body,
onConfirm,
onCancel,
launchButtonText,
title,
color,
colorScheme,
motionPreset = "slideInBottom",
cancelButtonText = "Cancel",
confirmButtonText = "Confirm",
}: DialogButtonProps) {
const { isOpen, onOpen, onClose } = useDisclosure();
const cancelRef = React.useRef<HTMLButtonElement>(null);
function onHandleConfirm() {
if (onConfirm) {
onConfirm();
}
onClose();
}
function onHandleCancel() {
if (onCancel) {
onCancel();
}
onClose();
}
return (
<>
<Button colorScheme={colorScheme} color={color} title={title} onClick={onOpen} size="sm" ml="4">
{launchButtonText}
</Button>
<AlertDialog
motionPreset={motionPreset}
leastDestructiveRef={cancelRef}
onClose={onClose}
isOpen={isOpen}
isCentered
>
<AlertDialogOverlay />
<AlertDialogContent bg="gray.300">
<AlertDialogHeader>{header}</AlertDialogHeader>
<AlertDialogCloseButton />
<AlertDialogBody>{body}</AlertDialogBody>
<AlertDialogFooter>
<Button ref={cancelRef} onClick={onHandleCancel}>
{cancelButtonText}
</Button>
<Button colorScheme="orange" ml={3} onClick={onHandleConfirm}>
{confirmButtonText}
</Button>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</>
);
}