File tree Expand file tree Collapse file tree
packages/ra-ui-materialui/src/button Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import * as React from 'react' ;
2+ import { createTheme } from '@mui/material' ;
3+ import type { PaletteColor } from '@mui/material' ;
4+ import { DeleteButton } from './DeleteButton' ;
5+ import { Form } from 'ra-core' ;
6+ import { AdminContext } from '../AdminContext' ;
7+
8+ export default { title : 'ra-ui-materialui/button/DeleteButton' } ;
9+
10+ export const Basic = ( ) => (
11+ < AdminContext >
12+ < Form record = { { id : 1 } } >
13+ < DeleteButton label = "Delete" />
14+ </ Form >
15+ </ AdminContext >
16+ ) ;
17+
18+ export const WithUserDefinedPalette = ( ) => (
19+ < AdminContext theme = { theme } >
20+ < Form record = { { id : 1 } } >
21+ < DeleteButton label = "Delete" />
22+ </ Form >
23+ </ AdminContext >
24+ ) ;
25+
26+ /**
27+ * Adding new theme tokens to the palette
28+ * @see https://mui.com/material-ui/experimental-api/css-theme-variables/customization/#typescript
29+ */
30+ const theme = createTheme ( {
31+ palette : {
32+ error : {
33+ main : '#FDDBD3' ,
34+ } ,
35+ } ,
36+ } ) ;
37+
38+ declare module '@mui/material/styles' {
39+ interface Palette {
40+ userDefined ?: PaletteColor ;
41+ }
42+ interface PaletteOptions {
43+ userDefined ?: PaletteColor ;
44+ }
45+ }
46+
47+ /**
48+ * Adding new theme tokens to the Button
49+ * https://mui.com/material-ui/customization/theme-components/#creating-new-component-variants
50+ */
51+ declare module '@mui/material/Button' {
52+ interface ButtonPropsColorOverrides {
53+ userDefined : true ;
54+ }
55+ }
You can’t perform that action at this time.
0 commit comments