diff --git a/docs/data/data-grid/style-recipes/CellFocusNoOutline.js b/docs/data/data-grid/style-recipes/CellFocusNoOutline.js new file mode 100644 index 000000000000..1936ceec9db3 --- /dev/null +++ b/docs/data/data-grid/style-recipes/CellFocusNoOutline.js @@ -0,0 +1,30 @@ +import * as React from 'react'; +import { DataGridPro, gridClasses } from '@mui/x-data-grid-pro'; +import { useDemoData } from '@mui/x-data-grid-generator'; + +const VISIBLE_FIELDS = ['name', 'rating', 'country', 'dateCreated', 'isAdmin']; + +export default function CellFocusNoOutline() { + const { data } = useDemoData({ + dataSet: 'Employee', + visibleFields: VISIBLE_FIELDS, + rowLength: 100, + }); + + return ( +
Advanced grid styling recipes.
+ +## Remove cell focus outline + +The data grid cells are actionable elements and visually indicate the `focus` state by default. +You can remove the focus outline by overriding the `:focus` and `:focus-within` styles for the cells and header cells. + +:::warning +Removing the visible `focus` state hurts the accessibility of the grid. +::: + +{{"demo": "CellFocusNoOutline.js", "bg": "inline", "defaultCodeOpen": false}} diff --git a/docs/data/pages.ts b/docs/data/pages.ts index 6f2186ad1e62..e38cdc9b7d4e 100644 --- a/docs/data/pages.ts +++ b/docs/data/pages.ts @@ -88,7 +88,14 @@ const pages: MuiPage[] = [ { pathname: '/x/react-data-grid/export' }, { pathname: '/x/react-data-grid/clipboard', title: 'Copy and paste', newFeature: true }, { pathname: '/x/react-data-grid/components', title: 'Custom subcomponents' }, - { pathname: '/x/react-data-grid/style' }, + { + pathname: '/x/react-data-grid/style-group', + title: 'Style', + children: [ + { pathname: '/x/react-data-grid/style', title: 'Overview' }, + { pathname: '/x/react-data-grid/style-recipes', title: 'Recipes' }, + ], + }, { pathname: '/x/react-data-grid/localization' }, { pathname: '/x/react-data-grid/scrolling' }, { pathname: '/x/react-data-grid/virtualization' }, diff --git a/docs/pages/x/react-data-grid/style-recipes.js b/docs/pages/x/react-data-grid/style-recipes.js new file mode 100644 index 000000000000..bdfb64e5b91b --- /dev/null +++ b/docs/pages/x/react-data-grid/style-recipes.js @@ -0,0 +1,7 @@ +import * as React from 'react'; +import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs'; +import * as pageProps from 'docsx/data/data-grid/style-recipes/style-recipes.md?@mui/markdown'; + +export default function Page() { + return