@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#ListItem
- @chakra-ui/react#Popover
- @chakra-ui/react#PopoverTrigger
- @chakra-ui/react#Button
- @chakra-ui/react#Code
- @chakra-ui/react#HStack
- @chakra-ui/react#Table
- @chakra-ui/react#Thead
- @chakra-ui/react#Tbody
- @chakra-ui/react#Tr
- @chakra-ui/react#Th
- @chakra-ui/react#Td
- @chakra-ui/react#Divider
- @chakra-ui/react#Accordion
- @chakra-ui/react#AccordionItem
- @chakra-ui/react#AccordionButton
- @chakra-ui/react#AccordionPanel
- @chakra-ui/react#AccordionIcon
- @chakra-ui/react#ButtonGroup
- @chakra-ui/react#OrderedList
- @chakra-ui/react#InputRightAddon
@chakra-ui/react#Tfoot TypeScript Examples
The following examples show how to use
@chakra-ui/react#Tfoot.
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: DopeTable.tsx From dope-monorepo with GNU General Public License v3.0 | 4 votes |
DopeTable = ({ className = '', data, selected, onSelect }: DopeTableProps) => {
const [sort, setSort] = useState('id');
const amountOfUnclaimedPaper = (): number => {
const paperPerToken = 125000;
let numberUnclaimed = 0;
for (const item of data) {
numberUnclaimed = item.claimed ? numberUnclaimed : numberUnclaimed + 1;
}
return numberUnclaimed * paperPerToken;
};
const formattedUnclaimedPaper = (): string => {
const formatter = Intl.NumberFormat('en', { notation: 'compact' });
return formatter.format(amountOfUnclaimedPaper());
};
const items = useMemo(
() =>
data
.map(({ id, opened, claimed, rank }, idx) => ({
id,
rank,
opened: opened ? (
''
) : (
<Check
css={css`
display: inline;
`}
/>
),
claimed: claimed ? (
''
) : (
<Check
css={css`
display: inline;
`}
/>
),
idx,
}))
.sort((a, b) => {
switch (sort) {
case 'id':
return a.id < b.id ? -1 : 1;
case 'rank':
return a.rank < b.rank ? -1 : 1;
default:
return a.id > b.id ? -1 : 1;
}
}),
[data, sort],
);
return (
<PanelContainer
className={className}
css={css`
tfoot th {
// Screen > Tablet display items side by side
span.separator {
display: block;
height: 0;
margin: 0;
padding: 0;
overflow: hidden;
${media.tablet`
display: inline;
font-size: var(--text-00);
height: auto;
padding: 8px;
color: #a8a9ae;
`}
}
}
`}
>
<div
css={css`
display: flex;
min-height: 100%;
flex-direction: column;
// justify-content: space-around;
// align-items: stretch;
`}
>
<Table variant="dope">
<colgroup>
<col width="25%" />
<col width="25%" />
<col width="25%" />
<col width="25%" />
</colgroup>
<Thead>
<Tr>
<Th onClick={() => setSort('id')}>Dope ID</Th>
<Th onClick={() => setSort('rank')}>Rank</Th>
<Th>Has Paper</Th>
<Th>Has Gear</Th>
</Tr>
</Thead>
<Tbody>
{items.map(({ id, rank, opened, claimed, idx }) => (
<Tr
className={selected === idx ? 'selected' : ''}
key={id}
onClick={() => onSelect(idx)}
>
<Td>{id}</Td>
<Td>{rank}</Td>
<Td>{claimed}</Td>
<Td>{opened}</Td>
</Tr>
))}
</Tbody>
<Tfoot>
<Th colSpan={4}>
{items.length} DOPE {items.length > 1 ? 'Tokens' : 'Token'}
<span
className="separator"
css={css`
padding: 8px;
color: rgb(168, 169, 174);
`}
>
/
</span>
{formattedUnclaimedPaper()} Unclaimed $PAPER
</Th>
</Tfoot>
</Table>
</div>
</PanelContainer>
);
}