@chakra-ui/react APIs
- Button
- Box
- ChakraProvider
- Text
- Flex
- Input
- Stack
- useDisclosure
- ModalOverlay
- ModalContent
- ModalBody
- Image
- Modal
- ModalCloseButton
- Heading
- IconButton
- ModalHeader
- extendTheme
- HStack
- Link
- Divider
- Tooltip
- SimpleGrid
- Spinner
- ModalFooter
- Center
- Table
- FormControl
- FormLabel
- useToast
- useColorMode
- InputGroup
- VStack
- Icon
- Select
- Menu
- MenuButton
- MenuList
- MenuItem
- Badge
- ListItem
- Thead
- Tr
- Th
- Tbody
- Td
- Container
- Alert
- useColorModeValue
- Spacer
- Tabs
- TabList
- Tab
- TabPanels
- TabPanel
- Skeleton
- Tag
- Avatar
- Textarea
- SkeletonText
- InputLeftElement
- Grid
- DrawerBody
- DrawerContent
- DrawerCloseButton
- DrawerHeader
- DrawerOverlay
- AspectRatio
- theme
- SkeletonCircle
- UnorderedList
- Code
- ButtonGroup
- PopoverTrigger
- Popover
- PopoverContent
- PopoverBody
- CSSReset
- Drawer
- DrawerFooter
- List
- FormHelperText
- InputRightElement
- Collapse
- AlertIcon
- Switch
- Stat
- StatLabel
- StatNumber
- ColorModeScript
- useClipboard
- Checkbox
- LinkBox
- LinkOverlay
- PopoverArrow
- PopoverHeader
- useTheme
- InputRightAddon
- keyframes
- useBreakpointValue
- StackDivider
- SliderTrack
- SliderFilledTrack
- SliderThumb
- Radio
- RadioGroup
- StatGroup
- OrderedList
- MenuDivider
- FormErrorMessage
- CloseButton
- useMediaQuery
- AlertTitle
- AlertDescription
- Accordion
- AccordionItem
- AccordionButton
- AccordionIcon
- AccordionPanel
- PopoverCloseButton
- GridItem
- ThemeProvider
- Progress
- useRadio
- useRadioGroup
- useBreakpoint
- Slider
- CircularProgress
- ColorModeProvider
- cookieStorageManager
- localStorageManager
- useBoolean
- AlertDialog
- AlertDialogBody
- AlertDialogCloseButton
- AlertDialogContent
- AlertDialogFooter
- AlertDialogHeader
- AlertDialogOverlay
- NumberInputField
- NumberInput
- useTab
- FormErrorIcon
- VisuallyHiddenInput
- Portal
- useToken
- useInterval
- VisuallyHidden
- Wrap
- WrapItem
- createIcon
- PopoverFooter
- AvatarBadge
- chakra
- forwardRef
- TableCaption
- Breadcrumb
- Kbd
- createStandaloneToast
OtherRelated APIs
- @chakra-ui/react#Button
- @chakra-ui/react#Heading
- @chakra-ui/react#HStack
- @chakra-ui/react#InputGroup
- @chakra-ui/react#Flex
- @chakra-ui/react#Stack
- @chakra-ui/react#Box
- @chakra-ui/react#Text
- @chakra-ui/react#Image
- @chakra-ui/react#MenuItem
- @chakra-ui/react#Center
- @chakra-ui/react#Modal
- @chakra-ui/react#ModalContent
- @chakra-ui/react#ModalCloseButton
- @chakra-ui/react#FormControl
- @chakra-ui/react#FormHelperText
- @chakra-ui/react#Textarea
- @chakra-ui/react#Stat
- @chakra-ui/react#MenuDivider
- @chakra-ui/react#LinkBox
- @chakra-ui/react#LinkOverlay
@chakra-ui/react#VisuallyHiddenInput JavaScript Examples
The following examples show how to use
@chakra-ui/react#VisuallyHiddenInput.
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: containers.js From idena-web with MIT License | 5 votes |
export function AdMediaInput({
name,
value,
label,
description,
fallbackSrc,
maybeError,
onChange,
...props
}) {
const src = React.useMemo(
() =>
isValidImage(value) ? URL.createObjectURL(value) : value ?? adFallbackSrc,
[value]
)
return (
<FormControl isInvalid={Boolean(maybeError)}>
<FormLabel htmlFor={name} m={0} p={0}>
<VisuallyHiddenInput
id={name}
name={name}
type="file"
accept="image/png,image/jpg,image/jpeg"
onChange={async e => {
if (onChange) {
const {files} = e.target
if (files.length) {
const [file] = files
if (hasImageType(file)) {
onChange(file)
}
}
}
}}
{...props}
/>
<HStack spacing={4} align="center" cursor="pointer">
<Box flexShrink={0}>
{src !== adFallbackSrc ? (
<AdImage src={src} width={70} />
) : (
<Center
bg="gray.50"
borderWidth={1}
borderColor="gray.016"
rounded="lg"
p="3"
>
<Image src={fallbackSrc} ignoreFallback boxSize="44px" />
</Center>
)}
</Box>
<Stack>
<HStack>
<LaptopIcon boxSize="5" color="blue.500" />
<Text color="blue.500" fontWeight={500}>
{label}
</Text>
</HStack>
<SmallText>{description}</SmallText>
</Stack>
</HStack>
<AdFormError>{maybeError}</AdFormError>
</FormLabel>
</FormControl>
)
}