Card with action buttons
A card of small icon buttons for common tasks.
A card of small icon buttons for common tasks.
npm install @mantine/core @tabler/icons-react
First time with Mantine UI? Set it up once.
/**
* Component from Mantine UI, https://ui.mantine.dev
* MIT License, Copyright (c) 2022 Vitaly Rtischev. Full text: https://github.com/mantinedev/ui.mantine.dev/blob/master/LICENCE
* Changed for Tastebud: icon colours come from the Figma palette.
*/
import {
IconBuildingBank,
IconCashBanknote,
IconCoin,
IconCreditCard,
IconReceipt,
IconReceiptRefund,
IconReceiptTax,
IconRepeat,
IconReport,
} from '@tabler/icons-react';
import {
Anchor,
Card,
Group,
SimpleGrid,
Text,
UnstyledButton,
} from '@mantine/core';
import classes from './ActionsGrid.module.css';
const mockdata = [
{ title: 'Credit cards', icon: IconCreditCard, color: '#A259FF' },
{ title: 'Banks nearby', icon: IconBuildingBank, color: '#1ABCFE' },
{ title: 'Transfers', icon: IconRepeat, color: '#0ACF83' },
{ title: 'Refunds', icon: IconReceiptRefund, color: '#F24E1E' },
{ title: 'Receipts', icon: IconReceipt, color: '#FF7262' },
{ title: 'Taxes', icon: IconReceiptTax, color: '#1E1E1E' },
{ title: 'Reports', icon: IconReport, color: '#A259FF' },
{ title: 'Payments', icon: IconCoin, color: '#1ABCFE' },
{ title: 'Cashback', icon: IconCashBanknote, color: '#0ACF83' },
];
export function ActionsGrid() {
const items = mockdata.map((item) => (
<UnstyledButton key={item.title} className={classes.item}>
<item.icon color={item.color} size={32} stroke={1.5} />
<Text size="xs" mt={7}>
{item.title}
</Text>
</UnstyledButton>
));
return (
<Card withBorder radius="md" className={classes.card}>
<Group justify="space-between">
<Text className={classes.title}>Services</Text>
<Anchor c="inherit" size="xs">
+ 21 other services
</Anchor>
</Group>
<SimpleGrid cols={3} mt="md">
{items}
</SimpleGrid>
</Card>
);
}
/**
* Component from Mantine UI, https://ui.mantine.dev
* MIT License, Copyright (c) 2022 Vitaly Rtischev. Full text: https://github.com/mantinedev/ui.mantine.dev/blob/master/LICENCE
* Changed for Tastebud: Mantine's PostCSS shorthands (@mixin, $mantine-breakpoint-*) are written out as
* plain CSS, so it runs without postcss-preset-mantine; headings use the theme font instead of Outfit.
*/
.card {
background-color: light-dark(var(--mantine-color-gray-0), var(--mantine-color-dark-7));
}
.title {
font-family: var(--mantine-font-family);
font-weight: 500;
}
.item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
border-radius: var(--mantine-radius-md);
height: 90px;
background-color: light-dark(var(--mantine-color-white), var(--mantine-color-dark-6));
transition:
box-shadow 150ms ease,
transform 100ms ease;
&:hover {
box-shadow: var(--mantine-shadow-sm);
transform: scale(1.02);
}
}
Changed for this site: Icon colours come from the Figma palette. Mantine's PostCSS shorthands (@mixin, $mantine-breakpoint-*) are written out as plain CSS, so it runs without postcss-preset-mantine; headings use the theme font instead of Outfit.