Skip to content

Commit 59e442e

Browse files
authored
Merge pull request #10369 from marmelab/demo-tabs
[Demo] Showcase tabs with icons
2 parents e7cc67f + 4aec101 commit 59e442e

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

examples/demo/src/products/ProductEdit.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ import {
1313
TextInput,
1414
useRecordContext,
1515
} from 'react-admin';
16+
import PhotoCameraIcon from '@mui/icons-material/PhotoCamera';
17+
import AspectRatioIcon from '@mui/icons-material/AspectRatio';
18+
import EditNoteIcon from '@mui/icons-material/EditNote';
19+
import ReviewIcon from '@mui/icons-material/Comment';
1620

1721
import { ProductEditDetails } from './ProductEditDetails';
1822
import CustomerReferenceField from '../visitors/CustomerReferenceField';
@@ -37,7 +41,9 @@ const ProductEdit = () => (
3741
<TabbedForm>
3842
<TabbedForm.Tab
3943
label="resources.products.tabs.image"
40-
sx={{ maxWidth: '40em' }}
44+
sx={{ maxWidth: '40em', minHeight: 48 }}
45+
iconPosition="start"
46+
icon={<PhotoCameraIcon />}
4147
>
4248
<Poster />
4349
<TextInput source="image" validate={req} />
@@ -46,14 +52,18 @@ const ProductEdit = () => (
4652
<TabbedForm.Tab
4753
label="resources.products.tabs.details"
4854
path="details"
49-
sx={{ maxWidth: '40em' }}
55+
sx={{ maxWidth: '40em', minHeight: 48 }}
56+
iconPosition="start"
57+
icon={<AspectRatioIcon />}
5058
>
5159
<ProductEditDetails />
5260
</TabbedForm.Tab>
5361
<TabbedForm.Tab
5462
label="resources.products.tabs.description"
5563
path="description"
56-
sx={{ maxWidth: '40em' }}
64+
sx={{ maxWidth: '40em', minHeight: 48 }}
65+
iconPosition="start"
66+
icon={<EditNoteIcon />}
5767
>
5868
<RichTextInput source="description" label="" validate={req} />
5969
</TabbedForm.Tab>
@@ -67,6 +77,9 @@ const ProductEdit = () => (
6777
/>
6878
}
6979
path="reviews"
80+
sx={{ minHeight: 48 }}
81+
iconPosition="start"
82+
icon={<ReviewIcon />}
7083
>
7184
<ReferenceManyField
7285
reference="reviews"

examples/demo/src/visitors/FullNameField.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ const FullNameField = (props: Props) => {
3030
mr: 1,
3131
mt: -0.5,
3232
mb: -0.5,
33+
textDecoration: 'underline',
34+
textDecorationColor: '#bdbdbd',
3335
}}
3436
/>
3537
{record.first_name} {record.last_name}

0 commit comments

Comments
 (0)