diff --git a/docs/pages/experiments/accordion-horizontal.tsx b/docs/pages/experiments/accordion-horizontal.tsx new file mode 100644 index 0000000000..96e1f02ff2 --- /dev/null +++ b/docs/pages/experiments/accordion-horizontal.tsx @@ -0,0 +1,179 @@ +import * as React from 'react'; +import * as Accordion from '@base_ui/react/Accordion'; + +function classNames(...classes: Array) { + return classes.filter(Boolean).join(' '); +} + +export default function App() { + const [val, setVal] = React.useState(['one']); + return ( +
+

Horizontal LTR

+ + {['one', 'two', 'three'].map((value, index) => ( + + + + {index + 1} + {value} + + + + This is the contents of Accordion.Panel {index + 1} + + + ))} + + + +

Horizontal RTL

+

one section must remain open

+
+ { + if (newValue.length > 0) { + setVal(newValue); + } + }} + > + {['one', 'two', 'three'].map((value, index) => ( + + + + {index + 1} + {value} + + + + This is the contents of Accordion.Panel {index + 1} + + + ))} + + +
+ ); +} + +function HorizontalStyles() { + return ( + + ); +} diff --git a/docs/pages/experiments/accordion-material.tsx b/docs/pages/experiments/accordion-material.tsx new file mode 100644 index 0000000000..3130c291ac --- /dev/null +++ b/docs/pages/experiments/accordion-material.tsx @@ -0,0 +1,108 @@ +import * as React from 'react'; +import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; +import * as Accordion from '@base_ui/react/Accordion'; + +export default function App() { + return ( +
+ + {[0, 1, 2, 3].map((index) => ( + + + + Trigger {index + 1} + + + + + This is the contents of Accordion.Panel {index + 1} + + + ))} + + +
+ ); +} + +function MaterialStyles() { + return ( + + ); +} diff --git a/docs/pages/experiments/accordion.tsx b/docs/pages/experiments/accordion.tsx index 94e537a392..eb194c65c7 100644 --- a/docs/pages/experiments/accordion.tsx +++ b/docs/pages/experiments/accordion.tsx @@ -1,12 +1,13 @@ import * as React from 'react'; import Check from '@mui/icons-material/Check'; -import { useTheme } from '@mui/system'; +// import { useTheme } from '@mui/system'; import * as Checkbox from '@base_ui/react/Checkbox'; import * as Accordion from '@base_ui/react/Accordion'; export default function App() { const [openMultiple, setOpenMultiple] = React.useState(true); const [val, setVal] = React.useState(['one']); + const [val2, setVal2] = React.useState(['one']); return (
multiple `Accordion.Section`s can be open at the same time: @@ -116,6 +117,50 @@ export default function App() { + +
+ +

Controlled, at least one section must remain open

+ + { + // console.log(newValue); + if (newValue.length > 0) { + setVal2(newValue); + } + }} + aria-label="Controlled Accordion, one section must remain open" + openMultiple={openMultiple} + > + + + Trigger 1 + + + This is the contents of Accordion.Panel 1, the value is "one" + + + + + + Trigger 2 + + + This is the contents of Accordion.Panel 2, the value is "two" + + + + + + Trigger 3 + + + This is the contents of Accordion.Panel 3, the value is "three" + + +
); @@ -130,14 +175,14 @@ const grey = { 900: '#1C2025', }; -function useIsDarkMode() { - const theme = useTheme(); - return theme.palette.mode === 'dark'; -} +// function useIsDarkMode() { +// const theme = useTheme(); +// return theme.palette.mode === 'dark'; +// } function Styles() { // Replace this with your app logic for determining dark mode - const isDarkMode = useIsDarkMode(); + // const isDarkMode = useIsDarkMode(); return (