index
int64
0
0
repo_id
stringlengths
16
181
file_path
stringlengths
28
270
content
stringlengths
1
11.6M
__index_level_0__
int64
0
10k
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/input/InputSubscription.preview
<Input placeholder="[email protected]" endDecorator={ <Button variant="solid" color="primary" sx={{ ml: 1 }}> Subscribe </Button> } />
1,200
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/input/InputSubscription.tsx
import * as React from 'react'; import FormControl from '@mui/joy/FormControl'; import FormLabel from '@mui/joy/FormLabel'; import FormHelperText from '@mui/joy/FormHelperText'; import Input from '@mui/joy/Input'; import Button from '@mui/joy/Button'; export default function InputSubscription() { const [data, setData] = React.useState<{ email: string; status: 'initial' | 'loading' | 'failure' | 'sent'; }>({ email: '', status: 'initial', }); const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => { event.preventDefault(); setData((current) => ({ ...current, status: 'loading' })); try { // Replace timeout with real backend operation setTimeout(() => { setData({ email: '', status: 'sent' }); }, 1500); } catch (error) { setData((current) => ({ ...current, status: 'failure' })); } }; return ( <form onSubmit={handleSubmit} id="demo"> <FormControl> <FormLabel sx={(theme) => ({ '--FormLabel-color': theme.vars.palette.primary.plainColor, })} > MUI Newsletter </FormLabel> <Input sx={{ '--Input-decoratorChildHeight': '45px' }} placeholder="[email protected]" type="email" required value={data.email} onChange={(event) => setData({ email: event.target.value, status: 'initial' }) } error={data.status === 'failure'} endDecorator={ <Button variant="solid" color="primary" loading={data.status === 'loading'} type="submit" sx={{ borderTopLeftRadius: 0, borderBottomLeftRadius: 0 }} > Subscribe </Button> } /> {data.status === 'failure' && ( <FormHelperText sx={(theme) => ({ color: theme.vars.palette.danger[400] })} > Oops! something went wrong, please try again later. </FormHelperText> )} {data.status === 'sent' && ( <FormHelperText sx={(theme) => ({ color: theme.vars.palette.primary[400] })} > You are all set! </FormHelperText> )} </FormControl> </form> ); }
1,201
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/input/InputUsage.js
import * as React from 'react'; import Input from '@mui/joy/Input'; import JoyUsageDemo from 'docs/src/modules/components/JoyUsageDemo'; export default function InputUsage() { return ( <JoyUsageDemo componentName="Input" data={[ { propName: 'variant', knob: 'radio', defaultValue: 'outlined', options: ['plain', 'outlined', 'soft', 'solid'], }, { propName: 'color', knob: 'color', defaultValue: 'neutral', }, { propName: 'size', knob: 'radio', options: ['sm', 'md', 'lg'], defaultValue: 'md', }, { propName: 'placeholder', knob: 'input', defaultValue: 'Type something…', }, { propName: 'disabled', knob: 'switch', defaultValue: false, }, ]} renderDemo={(props) => <Input {...props} />} /> ); }
1,202
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/input/InputValidation.js
import * as React from 'react'; import Input from '@mui/joy/Input'; import FormControl from '@mui/joy/FormControl'; import FormLabel from '@mui/joy/FormLabel'; import FormHelperText from '@mui/joy/FormHelperText'; import Stack from '@mui/joy/Stack'; import InfoOutlined from '@mui/icons-material/InfoOutlined'; export default function InputValidation() { return ( <Stack spacing={2}> <Input placeholder="Type in here…" error defaultValue="Oh no, error found!" /> <FormControl error> <FormLabel>Label</FormLabel> <Input placeholder="Type in here…" defaultValue="Oh no, error found!" /> <FormHelperText> <InfoOutlined /> Opps! something is wrong. </FormHelperText> </FormControl> </Stack> ); }
1,203
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/input/InputValidation.tsx
import * as React from 'react'; import Input from '@mui/joy/Input'; import FormControl from '@mui/joy/FormControl'; import FormLabel from '@mui/joy/FormLabel'; import FormHelperText from '@mui/joy/FormHelperText'; import Stack from '@mui/joy/Stack'; import InfoOutlined from '@mui/icons-material/InfoOutlined'; export default function InputValidation() { return ( <Stack spacing={2}> <Input placeholder="Type in here…" error defaultValue="Oh no, error found!" /> <FormControl error> <FormLabel>Label</FormLabel> <Input placeholder="Type in here…" defaultValue="Oh no, error found!" /> <FormHelperText> <InfoOutlined /> Opps! something is wrong. </FormHelperText> </FormControl> </Stack> ); }
1,204
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/input/InputValidation.tsx.preview
<Input placeholder="Type in here…" error defaultValue="Oh no, error found!" /> <FormControl error> <FormLabel>Label</FormLabel> <Input placeholder="Type in here…" defaultValue="Oh no, error found!" /> <FormHelperText> <InfoOutlined /> Opps! something is wrong. </FormHelperText> </FormControl>
1,205
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/input/InputVariables.js
import * as React from 'react'; import Box from '@mui/joy/Box'; import Input from '@mui/joy/Input'; import Button from '@mui/joy/Button'; import MailIcon from '@mui/icons-material/Mail'; import JoyVariablesDemo from 'docs/src/modules/components/JoyVariablesDemo'; export default function InputVariables() { return ( <JoyVariablesDemo componentName="Input" renderCode={(formattedSx) => `<Input startDecorator={<MailIcon />} endDecorator={<Button>Message</Button>}${formattedSx ? `${formattedSx}>` : '\n>'}`} data={[ { var: '--Input-radius', defaultValue: '8px', }, { var: '--Input-gap', defaultValue: '8px', }, { var: '--Input-placeholderOpacity', defaultValue: 0.5, inputAttributes: { min: 0.1, max: 1, step: 0.1, }, }, { var: '--Input-focusedThickness', defaultValue: '2px', }, { var: '--Input-minHeight', defaultValue: '40px', }, { var: '--Input-paddingInline', defaultValue: '12px', }, { var: '--Input-decoratorChildHeight', defaultValue: '32px', }, ]} renderDemo={(sx) => ( <Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 1, }} > <Input startDecorator={<MailIcon />} endDecorator={<Button>Message</Button>} placeholder="Type in here…" sx={sx} /> </Box> )} /> ); }
1,206
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/input/InputVariants.js
import * as React from 'react'; import Box from '@mui/joy/Box'; import Input from '@mui/joy/Input'; export default function InputVariants() { return ( <Box sx={{ py: 2, display: 'grid', gap: 2, alignItems: 'center', flexWrap: 'wrap', }} > <Input placeholder="Type in here…" variant="solid" /> <Input placeholder="Type in here…" variant="soft" /> <Input placeholder="Type in here…" variant="outlined" /> <Input placeholder="Type in here…" variant="plain" /> </Box> ); }
1,207
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/input/InputVariants.tsx
import * as React from 'react'; import Box from '@mui/joy/Box'; import Input from '@mui/joy/Input'; export default function InputVariants() { return ( <Box sx={{ py: 2, display: 'grid', gap: 2, alignItems: 'center', flexWrap: 'wrap', }} > <Input placeholder="Type in here…" variant="solid" /> <Input placeholder="Type in here…" variant="soft" /> <Input placeholder="Type in here…" variant="outlined" /> <Input placeholder="Type in here…" variant="plain" /> </Box> ); }
1,208
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/input/InputVariants.tsx.preview
<Input placeholder="Type in here…" variant="solid" /> <Input placeholder="Type in here…" variant="soft" /> <Input placeholder="Type in here…" variant="outlined" /> <Input placeholder="Type in here…" variant="plain" />
1,209
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/input/PasswordMeterInput.js
import * as React from 'react'; import Stack from '@mui/joy/Stack'; import Input from '@mui/joy/Input'; import LinearProgress from '@mui/joy/LinearProgress'; import Typography from '@mui/joy/Typography'; import Key from '@mui/icons-material/Key'; export default function PasswordMeterInput() { const [value, setValue] = React.useState(''); const minLength = 12; return ( <Stack spacing={0.5} sx={{ '--hue': Math.min(value.length * 10, 120), }} > <Input type="password" placeholder="Type in here…" startDecorator={<Key />} value={value} onChange={(event) => setValue(event.target.value)} /> <LinearProgress determinate size="sm" value={Math.min((value.length * 100) / minLength, 100)} sx={{ bgcolor: 'background.level3', color: 'hsl(var(--hue) 80% 40%)', }} /> <Typography level="body-xs" sx={{ alignSelf: 'flex-end', color: 'hsl(var(--hue) 80% 30%)' }} > {value.length < 3 && 'Very weak'} {value.length >= 3 && value.length < 6 && 'Weak'} {value.length >= 6 && value.length < 10 && 'Strong'} {value.length >= 10 && 'Very strong'} </Typography> </Stack> ); }
1,210
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/input/PasswordMeterInput.tsx
import * as React from 'react'; import Stack from '@mui/joy/Stack'; import Input from '@mui/joy/Input'; import LinearProgress from '@mui/joy/LinearProgress'; import Typography from '@mui/joy/Typography'; import Key from '@mui/icons-material/Key'; export default function PasswordMeterInput() { const [value, setValue] = React.useState(''); const minLength = 12; return ( <Stack spacing={0.5} sx={{ '--hue': Math.min(value.length * 10, 120), }} > <Input type="password" placeholder="Type in here…" startDecorator={<Key />} value={value} onChange={(event) => setValue(event.target.value)} /> <LinearProgress determinate size="sm" value={Math.min((value.length * 100) / minLength, 100)} sx={{ bgcolor: 'background.level3', color: 'hsl(var(--hue) 80% 40%)', }} /> <Typography level="body-xs" sx={{ alignSelf: 'flex-end', color: 'hsl(var(--hue) 80% 30%)' }} > {value.length < 3 && 'Very weak'} {value.length >= 3 && value.length < 6 && 'Weak'} {value.length >= 6 && value.length < 10 && 'Strong'} {value.length >= 10 && 'Very strong'} </Typography> </Stack> ); }
1,211
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/input/TriggerFocusInput.js
import * as React from 'react'; import Input from '@mui/joy/Input'; export default function TriggerFocusInput() { return ( <Input placeholder="Looks like I'm focused but no" sx={{ '--Input-focused': 1, width: 256 }} /> ); }
1,212
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/input/TriggerFocusInput.tsx
import * as React from 'react'; import Input from '@mui/joy/Input'; export default function TriggerFocusInput() { return ( <Input placeholder="Looks like I'm focused but no" sx={{ '--Input-focused': 1, width: 256 }} /> ); }
1,213
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/input/TriggerFocusInput.tsx.preview
<Input placeholder="Looks like I'm focused but no" sx={{ '--Input-focused': 1, width: 256 }} />
1,214
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/input/UnderlineInput.js
import * as React from 'react'; import Input from '@mui/joy/Input'; import Stack from '@mui/joy/Stack'; export default function UnderlineInput() { return ( <Stack spacing={2}> <Input placeholder="Type in here…" sx={{ '&::before': { border: '1.5px solid var(--Input-focusedHighlight)', transform: 'scaleX(0)', left: '2.5px', right: '2.5px', bottom: 0, top: 'unset', transition: 'transform .15s cubic-bezier(0.1,0.9,0.2,1)', borderRadius: 0, borderBottomLeftRadius: '64px 20px', borderBottomRightRadius: '64px 20px', }, '&:focus-within::before': { transform: 'scaleX(1)', }, }} /> <Input placeholder="Type in here…" variant="soft" sx={{ '--Input-radius': '0px', borderBottom: '2px solid', borderColor: 'neutral.outlinedBorder', '&:hover': { borderColor: 'neutral.outlinedHoverBorder', }, '&::before': { border: '1px solid var(--Input-focusedHighlight)', transform: 'scaleX(0)', left: 0, right: 0, bottom: '-2px', top: 'unset', transition: 'transform .15s cubic-bezier(0.1,0.9,0.2,1)', borderRadius: 0, }, '&:focus-within::before': { transform: 'scaleX(1)', }, }} /> </Stack> ); }
1,215
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/input/UnderlineInput.tsx
import * as React from 'react'; import Input from '@mui/joy/Input'; import Stack from '@mui/joy/Stack'; export default function UnderlineInput() { return ( <Stack spacing={2}> <Input placeholder="Type in here…" sx={{ '&::before': { border: '1.5px solid var(--Input-focusedHighlight)', transform: 'scaleX(0)', left: '2.5px', right: '2.5px', bottom: 0, top: 'unset', transition: 'transform .15s cubic-bezier(0.1,0.9,0.2,1)', borderRadius: 0, borderBottomLeftRadius: '64px 20px', borderBottomRightRadius: '64px 20px', }, '&:focus-within::before': { transform: 'scaleX(1)', }, }} /> <Input placeholder="Type in here…" variant="soft" sx={{ '--Input-radius': '0px', borderBottom: '2px solid', borderColor: 'neutral.outlinedBorder', '&:hover': { borderColor: 'neutral.outlinedHoverBorder', }, '&::before': { border: '1px solid var(--Input-focusedHighlight)', transform: 'scaleX(0)', left: 0, right: 0, bottom: '-2px', top: 'unset', transition: 'transform .15s cubic-bezier(0.1,0.9,0.2,1)', borderRadius: 0, }, '&:focus-within::before': { transform: 'scaleX(1)', }, }} /> </Stack> ); }
1,216
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/input/input.md
--- productId: joy-ui title: React Input component components: FormControl, FormHelperText, FormLabel, Input unstyled: /base-ui/react-input/ --- # Input <p class="description">The Input component facilitates the entry of text data from the user.</p> {{"component": "modules/components/ComponentLinkHeader.js"}} ## Introduction The Input component enhances the functionality of the native HTML `<input>` tag by providing expanded customization options and accessibility features. {{"demo": "InputUsage.js", "hideToolbar": true, "bg": "gradient"}} ## Basics ```jsx import Input from '@mui/joy/Input'; ``` The Input component provides a customizable input field that can be used to collect user information, such as name, email, password, or other types of data. {{"demo": "BasicInput.js"}} ## Customization ### Variants The Input component supports Joy UI's four [global variants](/joy-ui/main-features/global-variants/): `solid` (default), `soft`, `outlined`, and `plain`. {{"demo": "InputVariants.js"}} :::info To learn how to add your own variants, check out [Themed components—Extend variants](/joy-ui/customization/themed-components/#extend-variants). Note that you lose the global variants when you add custom variants. ::: ### Sizes The input component comes in three sizes: `sm`, `md` (default), and `lg`: {{"demo": "InputSizes.js"}} :::info To learn how to add custom sizes to the component, check out [Themed components—Extend sizes](/joy-ui/customization/themed-components/#extend-sizes). ::: ### Colors Every palette included in the theme is available via the `color` prop. {{"demo": "InputColors.js"}} ### Form submission You can add standard form attributes such as `required` and `disabled` to the Input component: {{"demo": "InputFormProps.js"}} ### Focused ring Provide these CSS variables to `sx` prop to control the focused ring appearance: - `--Input-focusedInset`: the focused ring's **position**, either inside(`inset`) or outside(`var(--any, )`) of the Input. - `--Input-focusedThickness`: the **size** of the focused ring. - `--Input-focusedHighlight`: the **color** of the focused ring. {{"demo": "FocusedRingInput.js"}} :::success To get full control of the focused ring, customize the `box-shadow` of the `::before` pseudo element directly ```js <Input sx={{ '&:focus-within::before': { boxShadow: '...your custom value' } }} /> ``` ::: #### Debugging the focus ring To display the Input's focus ring by simulating user's focus, inspect the Input element and toggle the [pseudostate panel](https://developer.chrome.com/docs/devtools/css/#pseudostates). - If you inspect the Input's root element, with `.MuiInput-root` class, you have to toggle on the `:focus-within` state. - If you inspect the `<input>` element, you can toggle with either `:focus` or `:focus-within` states. ### Triggering the focus ring To trigger the focus ring programmatically, set the CSS variable `--Input-focused: 1`. {{"demo": "TriggerFocusInput.js"}} :::info The focus ring still appear on focus even though you set `--Input-focused: 0`. ::: ### Label and helper text Group Input with the Form label and Form helper text in a Form control component to create a text field. {{"demo": "InputField.js"}} ### Validation Use the `error` prop on Input or Form Control to toggle the error state: {{"demo": "InputValidation.js"}} :::info Using the `color` prop with `danger` as the value gives you the same result: ```js <Input color="danger" /> ``` ::: ### Decorators The `startDecorator` and `endDecorator` props can be used to add supporting icons or elements to the input. With inputs, decorators are typically located at the top and/or bottom of the input field. {{"demo": "InputDecorators.js"}} ### Inner HTML input If you need to pass props to the inner HTML `<input>`, use `slotProps={{ input: { ...props } }}`. These props may include HTML attributes such as `ref`, `min`, `max`, and `autocomplete`. {{"demo": "InputSlotProps.js"}} ## CSS variables playground Play around with the CSS variables available to the Input component to see how the design changes. You can use these to customize the component with both the `sx` prop and the theme. {{"demo": "InputVariables.js", "hideToolbar": true, "bg": "gradient"}} ## Common examples ### Focus outline This example shows how to replace the default focus ring (using `::before`) with CSS `outline`. {{"demo": "FocusOutlineInput.js"}} ### Floating label To create a floating label input, a custom component (combination of `<input>` and `<label>`) is required to replace the default input slot. {{"demo": "FloatingLabelInput.js"}} ### Underline input {{"demo": "UnderlineInput.js"}} ### Newsletter Subscription {{"demo": "InputSubscription.js"}} ### Password meter {{"demo": "PasswordMeterInput.js"}} ### Debounced Input {{"demo": "DebouncedInput.js"}} ### Third-party formatting The Input component can be integrated with third-party formatting libraries for more complex use cases. Create an adapter component to get the props from the Input component and map them to the third-party component APIs. Then use that adapter as a value to the `slotProps.input.component` property of the Joy UI Input. The demos below illustrate how to do this with two popular libraries. #### React imask [react-imask](https://github.com/uNmAnNeR/imaskjs/tree/master/packages/react-imask) provides the `IMaskInput` component for complex formatting options. {{"demo": "InputReactImask.js"}} #### React number format [react-number-format](https://github.com/s-yadav/react-number-format) provides the `NumericFormat` component for enforcing text formatting that follows a specific number or string pattern. {{"demo": "InputReactNumberFormat.js"}} ## Accessibility All inputs should have a descriptive label linked to help users understand its purpose. The Form Control component automatically generates a unique ID that links the Input with the Form Label and Form Helper Text components: {{"demo": "InputField.js"}} Alternatively, you can do this manually by targeting the input slot—see [inner HTML input](#inner-html-input) for details: ```jsx <label htmlFor="unique-id">Label</label> <Input slotProps={{ input: { id: 'unique-id', } }} /> ``` ## Anatomy The Input component is composed of a root `<div>` with an `<input>` nested inside: ```html <div class="MuiInput-root"> <input class="MuiInput-input" /> </div> ```
1,217
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/linear-progress/LinearProgressColors.js
import * as React from 'react'; import LinearProgress from '@mui/joy/LinearProgress'; import Box from '@mui/joy/Box'; import Radio from '@mui/joy/Radio'; import RadioGroup from '@mui/joy/RadioGroup'; import Sheet from '@mui/joy/Sheet'; import Stack from '@mui/joy/Stack'; import Typography from '@mui/joy/Typography'; export default function LinearProgressColors() { const [variant, setVariant] = React.useState('soft'); return ( <Box sx={{ width: '100%', display: 'flex', alignItems: 'center', gap: 3, }} > <Stack spacing={2} sx={{ flex: 1 }}> <LinearProgress color="primary" variant={variant} /> <LinearProgress color="neutral" variant={variant} /> <LinearProgress color="danger" variant={variant} /> <LinearProgress color="success" variant={variant} /> <LinearProgress color="warning" variant={variant} /> </Stack> <Sheet sx={{ background: 'transparent', pl: 4, borderLeft: '1px solid', borderColor: 'divider', }} > <Typography level="body-sm" fontWeight="xl" id="variant-label" textColor="text.primary" mb={1} > Variant: </Typography> <RadioGroup size="sm" aria-labelledby="variant-label" name="variant" value={variant} onChange={(event) => setVariant(event.target.value)} > <Radio label="Solid" value="solid" /> <Radio label="Soft" value="soft" /> <Radio label="Outlined" value="outlined" /> <Radio label="Plain" value="plain" /> </RadioGroup> </Sheet> </Box> ); }
1,218
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/linear-progress/LinearProgressColors.tsx
import * as React from 'react'; import LinearProgress from '@mui/joy/LinearProgress'; import Box from '@mui/joy/Box'; import Radio from '@mui/joy/Radio'; import RadioGroup from '@mui/joy/RadioGroup'; import Sheet from '@mui/joy/Sheet'; import Stack from '@mui/joy/Stack'; import Typography from '@mui/joy/Typography'; import { VariantProp } from '@mui/joy/styles'; export default function LinearProgressColors() { const [variant, setVariant] = React.useState<VariantProp>('soft'); return ( <Box sx={{ width: '100%', display: 'flex', alignItems: 'center', gap: 3, }} > <Stack spacing={2} sx={{ flex: 1 }}> <LinearProgress color="primary" variant={variant} /> <LinearProgress color="neutral" variant={variant} /> <LinearProgress color="danger" variant={variant} /> <LinearProgress color="success" variant={variant} /> <LinearProgress color="warning" variant={variant} /> </Stack> <Sheet sx={{ background: 'transparent', pl: 4, borderLeft: '1px solid', borderColor: 'divider', }} > <Typography level="body-sm" fontWeight="xl" id="variant-label" textColor="text.primary" mb={1} > Variant: </Typography> <RadioGroup size="sm" aria-labelledby="variant-label" name="variant" value={variant} onChange={(event) => setVariant(event.target.value as VariantProp)} > <Radio label="Solid" value="solid" /> <Radio label="Soft" value="soft" /> <Radio label="Outlined" value="outlined" /> <Radio label="Plain" value="plain" /> </RadioGroup> </Sheet> </Box> ); }
1,219
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/linear-progress/LinearProgressCountUp.js
import * as React from 'react'; import LinearProgress from '@mui/joy/LinearProgress'; import Typography from '@mui/joy/Typography'; import { useCountUp } from 'use-count-up'; export default function LinearProgressCountUp() { const { value } = useCountUp({ isCounting: true, duration: 5, easing: 'linear', start: 0, end: 75, onComplete: () => ({ shouldRepeat: true, delay: 2, }), }); return ( <LinearProgress determinate variant="outlined" color="neutral" size="sm" thickness={24} value={Number(value)} sx={{ '--LinearProgress-radius': '20px', '--LinearProgress-thickness': '24px', }} > <Typography level="body-xs" fontWeight="xl" textColor="common.white" sx={{ mixBlendMode: 'difference' }} > LOADING… {`${Math.round(Number(value))}%`} </Typography> </LinearProgress> ); }
1,220
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/linear-progress/LinearProgressCountUp.tsx
import * as React from 'react'; import LinearProgress from '@mui/joy/LinearProgress'; import Typography from '@mui/joy/Typography'; import { useCountUp } from 'use-count-up'; export default function LinearProgressCountUp() { const { value } = useCountUp({ isCounting: true, duration: 5, easing: 'linear', start: 0, end: 75, onComplete: () => ({ shouldRepeat: true, delay: 2, }), }); return ( <LinearProgress determinate variant="outlined" color="neutral" size="sm" thickness={24} value={Number(value!)} sx={{ '--LinearProgress-radius': '20px', '--LinearProgress-thickness': '24px', }} > <Typography level="body-xs" fontWeight="xl" textColor="common.white" sx={{ mixBlendMode: 'difference' }} > LOADING… {`${Math.round(Number(value!))}%`} </Typography> </LinearProgress> ); }
1,221
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/linear-progress/LinearProgressDeterminate.js
import * as React from 'react'; import Stack from '@mui/joy/Stack'; import LinearProgress from '@mui/joy/LinearProgress'; export default function LinearProgressDeterminate() { const [progress, setProgress] = React.useState(0); React.useEffect(() => { const timer = setInterval(() => { setProgress((prevProgress) => (prevProgress >= 100 ? 0 : prevProgress + 10)); }, 800); return () => { clearInterval(timer); }; }, []); return ( <Stack spacing={2} sx={{ flex: 1 }}> <LinearProgress determinate value={25} /> <LinearProgress determinate value={50} /> <LinearProgress determinate value={75} /> <LinearProgress determinate value={100} /> <LinearProgress determinate value={progress} /> </Stack> ); }
1,222
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/linear-progress/LinearProgressDeterminate.tsx
import * as React from 'react'; import Stack from '@mui/joy/Stack'; import LinearProgress from '@mui/joy/LinearProgress'; export default function LinearProgressDeterminate() { const [progress, setProgress] = React.useState(0); React.useEffect(() => { const timer = setInterval(() => { setProgress((prevProgress) => (prevProgress >= 100 ? 0 : prevProgress + 10)); }, 800); return () => { clearInterval(timer); }; }, []); return ( <Stack spacing={2} sx={{ flex: 1 }}> <LinearProgress determinate value={25} /> <LinearProgress determinate value={50} /> <LinearProgress determinate value={75} /> <LinearProgress determinate value={100} /> <LinearProgress determinate value={progress} /> </Stack> ); }
1,223
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/linear-progress/LinearProgressDeterminate.tsx.preview
<LinearProgress determinate value={25} /> <LinearProgress determinate value={50} /> <LinearProgress determinate value={75} /> <LinearProgress determinate value={100} /> <LinearProgress determinate value={progress} />
1,224
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/linear-progress/LinearProgressSizes.js
import * as React from 'react'; import Stack from '@mui/joy/Stack'; import LinearProgress from '@mui/joy/LinearProgress'; export default function LinearProgressSizes() { return ( <Stack spacing={2} sx={{ flex: 1 }}> <LinearProgress size="sm" /> <LinearProgress size="md" /> <LinearProgress size="lg" /> </Stack> ); }
1,225
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/linear-progress/LinearProgressSizes.tsx
import * as React from 'react'; import Stack from '@mui/joy/Stack'; import LinearProgress from '@mui/joy/LinearProgress'; export default function LinearProgressSizes() { return ( <Stack spacing={2} sx={{ flex: 1 }}> <LinearProgress size="sm" /> <LinearProgress size="md" /> <LinearProgress size="lg" /> </Stack> ); }
1,226
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/linear-progress/LinearProgressSizes.tsx.preview
<LinearProgress size="sm" /> <LinearProgress size="md" /> <LinearProgress size="lg" />
1,227
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/linear-progress/LinearProgressThickness.js
import * as React from 'react'; import LinearProgress from '@mui/joy/LinearProgress'; export default function LinearProgressThickness() { return <LinearProgress thickness={1} />; }
1,228
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/linear-progress/LinearProgressThickness.tsx
import * as React from 'react'; import LinearProgress from '@mui/joy/LinearProgress'; export default function LinearProgressThickness() { return <LinearProgress thickness={1} />; }
1,229
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/linear-progress/LinearProgressThickness.tsx.preview
<LinearProgress thickness={1} />
1,230
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/linear-progress/LinearProgressUsage.js
import * as React from 'react'; import LinearProgress from '@mui/joy/LinearProgress'; import Box from '@mui/joy/Box'; import JoyUsageDemo from 'docs/src/modules/components/JoyUsageDemo'; export default function LinearProgressUsage() { return ( <JoyUsageDemo componentName="LinearProgress" data={[ { propName: 'variant', knob: 'radio', defaultValue: 'soft', options: ['plain', 'outlined', 'soft', 'solid'], }, { propName: 'color', knob: 'color', defaultValue: 'primary', }, { propName: 'size', knob: 'radio', options: ['sm', 'md', 'lg'], defaultValue: 'md', }, { propName: 'determinate', knob: 'switch', defaultValue: false, }, { propName: 'value', knob: 'number', defaultValue: 25, }, ]} renderDemo={(props) => ( <Box sx={{ width: 300 }}> <LinearProgress {...props} /> </Box> )} /> ); }
1,231
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/linear-progress/LinearProgressVariables.js
import * as React from 'react'; import LinearProgress from '@mui/joy/LinearProgress'; import Box from '@mui/joy/Box'; import JoyVariablesDemo from 'docs/src/modules/components/JoyVariablesDemo'; export default function LinearProgressVariables() { return ( <JoyVariablesDemo componentName="LinearProgress" data={[ { var: '--LinearProgress-thickness', defaultValue: '6px', }, { var: '--LinearProgress-radius', helperText: "Default to root's thickness", }, { var: '--LinearProgress-progressThickness', helperText: "Default to root's thickness", }, { var: '--LinearProgress-progressRadius', helperText: "Default to root's thickness", }, ]} renderDemo={(sx) => ( <Box sx={{ width: 300 }}> <LinearProgress sx={sx} /> </Box> )} /> ); }
1,232
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/linear-progress/LinearProgressVariables.tsx
import * as React from 'react'; import LinearProgress from '@mui/joy/LinearProgress'; import Box from '@mui/joy/Box'; import JoyVariablesDemo from 'docs/src/modules/components/JoyVariablesDemo'; export default function LinearProgressVariables() { return ( <JoyVariablesDemo componentName="LinearProgress" data={[ { var: '--LinearProgress-thickness', defaultValue: '6px', }, { var: '--LinearProgress-radius', helperText: "Default to root's thickness", }, { var: '--LinearProgress-progressThickness', helperText: "Default to root's thickness", }, { var: '--LinearProgress-progressRadius', helperText: "Default to root's thickness", }, ]} renderDemo={(sx) => ( <Box sx={{ width: 300 }}> <LinearProgress sx={sx} /> </Box> )} /> ); }
1,233
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/linear-progress/LinearProgressVariants.js
import * as React from 'react'; import Stack from '@mui/joy/Stack'; import LinearProgress from '@mui/joy/LinearProgress'; export default function LinearProgressVariants() { return ( <Stack spacing={2} sx={{ flex: 1 }}> <LinearProgress variant="solid" /> <LinearProgress variant="soft" /> <LinearProgress variant="outlined" /> <LinearProgress variant="plain" /> </Stack> ); }
1,234
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/linear-progress/LinearProgressVariants.tsx
import * as React from 'react'; import Stack from '@mui/joy/Stack'; import LinearProgress from '@mui/joy/LinearProgress'; export default function LinearProgressVariants() { return ( <Stack spacing={2} sx={{ flex: 1 }}> <LinearProgress variant="solid" /> <LinearProgress variant="soft" /> <LinearProgress variant="outlined" /> <LinearProgress variant="plain" /> </Stack> ); }
1,235
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/linear-progress/LinearProgressVariants.tsx.preview
<LinearProgress variant="solid" /> <LinearProgress variant="soft" /> <LinearProgress variant="outlined" /> <LinearProgress variant="plain" />
1,236
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/linear-progress/LinearProgressWithLabel.js
import * as React from 'react'; import LinearProgress from '@mui/joy/LinearProgress'; import Typography from '@mui/joy/Typography'; export default function LinearProgressWithLabel() { const [progress, setProgress] = React.useState(0); React.useEffect(() => { const timer = setInterval(() => { setProgress((prevProgress) => (prevProgress >= 100 ? 0 : prevProgress + 10)); }, 800); return () => { clearInterval(timer); }; }, []); return ( <LinearProgress determinate variant="outlined" color="neutral" size="sm" thickness={32} value={progress} sx={{ '--LinearProgress-radius': '0px', '--LinearProgress-progressThickness': '24px', boxShadow: 'sm', borderColor: 'neutral.500', }} > <Typography level="body-xs" fontWeight="xl" textColor="common.white" sx={{ mixBlendMode: 'difference' }} > LOADING… {`${Math.round(progress)}%`} </Typography> </LinearProgress> ); }
1,237
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/linear-progress/LinearProgressWithLabel.tsx
import * as React from 'react'; import LinearProgress from '@mui/joy/LinearProgress'; import Typography from '@mui/joy/Typography'; export default function LinearProgressWithLabel() { const [progress, setProgress] = React.useState(0); React.useEffect(() => { const timer = setInterval(() => { setProgress((prevProgress) => (prevProgress >= 100 ? 0 : prevProgress + 10)); }, 800); return () => { clearInterval(timer); }; }, []); return ( <LinearProgress determinate variant="outlined" color="neutral" size="sm" thickness={32} value={progress} sx={{ '--LinearProgress-radius': '0px', '--LinearProgress-progressThickness': '24px', boxShadow: 'sm', borderColor: 'neutral.500', }} > <Typography level="body-xs" fontWeight="xl" textColor="common.white" sx={{ mixBlendMode: 'difference' }} > LOADING… {`${Math.round(progress)}%`} </Typography> </LinearProgress> ); }
1,238
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/linear-progress/linear-progress.md
--- productId: joy-ui title: React Linear Progress component components: LinearProgress githubLabel: 'component: LinearProgress' --- # Linear Progress <p class="description">Linear Progress indicators, commonly known as loaders, express an unspecified wait time or display the length of a process.</p> {{"component": "modules/components/ComponentLinkHeader.js"}} ## Introduction Progress indicators inform users about the status of ongoing processes, such as loading an app, submitting a form, or saving updates. The `LinearProgress` is indeterminate by default, indicating an unspecified wait time. To actually have it represent how long an operation will take, use the [determinate](#determinate) mode. The animations of the components rely on CSS as much as possible to work even before the JavaScript is loaded. {{"demo": "LinearProgressUsage.js", "hideToolbar": true, "bg": "gradient"}} ## Component After [installation](/joy-ui/getting-started/installation/), you can start building with this component using the following basic elements: ```jsx import LinearProgress from '@mui/joy/LinearProgress'; export default function MyApp() { return <LinearProgress />; } ``` ### Variants The linear progress component supports the four global variants: `solid`, `soft` (default), `outlined`, and `plain`. {{"demo": "LinearProgressVariants.js"}} ### Colors Every palette included in the theme is available via the `color` prop. Play around combining different colors. {{"demo": "LinearProgressColors.js"}} ### Sizes The linear progress component comes with three sizes out of the box: `sm`, `md` (the default), and `lg`. {{"demo": "LinearProgressSizes.js"}} :::info To learn how to add more sizes to the component, check out [Themed components—Extend sizes](/joy-ui/customization/themed-components/#extend-sizes). ::: ### Determinate You can use the `determinate` prop if you want to indicate a specified wait time. {{"demo": "LinearProgressDeterminate.js"}} ### Thickness Provides a number to `thickness` prop to control the bar's stroke width. {{"demo": "LinearProgressThickness.js"}} ## 3rd-party integration ### use-count-up Using the [use-count-up](https://www.npmjs.com/package/use-count-up) package, you can create a counting animation by providing `start`, `end`, and `duration` values. {{"demo": "LinearProgressCountUp.js"}} ## CSS variables playground Play around with all the CSS variables available on the component to see how the design changes. You can use those to customize the component on both the `sx` prop and the theme. {{"demo": "LinearProgressVariables.js", "hideToolbar": true, "bg": "gradient"}} ## Common examples ### With label {{"demo": "LinearProgressWithLabel.js"}}
1,239
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/BasicsLink.js
import * as React from 'react'; import Link from '@mui/joy/Link'; import Box from '@mui/joy/Box'; export default function BasicsLink() { return ( <Box sx={{ display: 'flex', gap: 2, flexWrap: 'wrap' }}> <Link href="#basics">Link</Link> <Link href="#basics" disabled> Disabled </Link> </Box> ); }
1,240
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/BasicsLink.tsx
import * as React from 'react'; import Link from '@mui/joy/Link'; import Box from '@mui/joy/Box'; export default function BasicsLink() { return ( <Box sx={{ display: 'flex', gap: 2, flexWrap: 'wrap' }}> <Link href="#basics">Link</Link> <Link href="#basics" disabled> Disabled </Link> </Box> ); }
1,241
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/BasicsLink.tsx.preview
<Link href="#basics">Link</Link> <Link href="#basics" disabled> Disabled </Link>
1,242
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/DecoratorExamples.js
import * as React from 'react'; import Box from '@mui/joy/Box'; import CircularProgress from '@mui/joy/CircularProgress'; import Link from '@mui/joy/Link'; import Chip from '@mui/joy/Chip'; export default function DecoratorExamples() { return ( <Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 4 }} > <Link href="#common-examples" disabled startDecorator={<CircularProgress />}> Processing... </Link> <Link href="#common-examples" underline="none" variant="outlined" color="neutral" endDecorator={ <Chip color="success" variant="soft" size="sm" sx={{}}> hiring </Chip> } sx={{ '--Link-gap': '0.5rem', pl: 1, py: 0.5, borderRadius: 'md' }} > Careers </Link> </Box> ); }
1,243
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/DecoratorExamples.tsx
import * as React from 'react'; import Box from '@mui/joy/Box'; import CircularProgress from '@mui/joy/CircularProgress'; import Link from '@mui/joy/Link'; import Chip from '@mui/joy/Chip'; export default function DecoratorExamples() { return ( <Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 4 }} > <Link href="#common-examples" disabled startDecorator={<CircularProgress />}> Processing... </Link> <Link href="#common-examples" underline="none" variant="outlined" color="neutral" endDecorator={ <Chip color="success" variant="soft" size="sm" sx={{}}> hiring </Chip> } sx={{ '--Link-gap': '0.5rem', pl: 1, py: 0.5, borderRadius: 'md' }} > Careers </Link> </Box> ); }
1,244
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/LinkAndTypography.js
import * as React from 'react'; import Box from '@mui/joy/Box'; import Link from '@mui/joy/Link'; import Typography from '@mui/joy/Typography'; import Launch from '@mui/icons-material/Launch'; import LinkIcon from '@mui/icons-material/Link'; export default function LinkAndTypography() { return ( <Box sx={{ maxWidth: 360 }}> <Typography id="heading-demo" level="h2" fontSize="lg" endDecorator={ <Link variant="outlined" aria-labelledby="heading-demo" href="#heading-demo" fontSize="md" borderRadius="sm" > <LinkIcon /> </Link> } mb={1} sx={{ scrollMarginTop: 100 }} > Heading </Typography> <Typography> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore{' '} <Link href="#heading-demo" startDecorator={<Launch />}> Magna Aliqua </Link> . Maecenas sed enim ut sem viverra aliquet eget. </Typography> </Box> ); }
1,245
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/LinkAndTypography.tsx
import * as React from 'react'; import Box from '@mui/joy/Box'; import Link from '@mui/joy/Link'; import Typography from '@mui/joy/Typography'; import Launch from '@mui/icons-material/Launch'; import LinkIcon from '@mui/icons-material/Link'; export default function LinkAndTypography() { return ( <Box sx={{ maxWidth: 360 }}> <Typography id="heading-demo" level="h2" fontSize="lg" endDecorator={ <Link variant="outlined" aria-labelledby="heading-demo" href="#heading-demo" fontSize="md" borderRadius="sm" > <LinkIcon /> </Link> } mb={1} sx={{ scrollMarginTop: 100 }} > Heading </Typography> <Typography> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore{' '} <Link href="#heading-demo" startDecorator={<Launch />}> Magna Aliqua </Link> . Maecenas sed enim ut sem viverra aliquet eget. </Typography> </Box> ); }
1,246
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/LinkCard.js
import * as React from 'react'; import Avatar from '@mui/joy/Avatar'; import Card from '@mui/joy/Card'; import Link from '@mui/joy/Link'; import Typography from '@mui/joy/Typography'; export default function LinkCard() { return ( <Card variant="outlined" sx={{ display: 'flex', gap: 2 }}> <Avatar size="lg" src="/static/images/avatar/1.jpg" /> <Link overlay href="#introduction" underline="none" sx={{ display: 'flex', flexDirection: 'column', alignItems: 'start' }} > <Typography level="body-md">Joy UI</Typography> <Typography level="body-sm">Components that spark joy!</Typography> </Link> </Card> ); }
1,247
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/LinkCard.tsx
import * as React from 'react'; import Avatar from '@mui/joy/Avatar'; import Card from '@mui/joy/Card'; import Link from '@mui/joy/Link'; import Typography from '@mui/joy/Typography'; export default function LinkCard() { return ( <Card variant="outlined" sx={{ display: 'flex', gap: 2 }}> <Avatar size="lg" src="/static/images/avatar/1.jpg" /> <Link overlay href="#introduction" underline="none" sx={{ display: 'flex', flexDirection: 'column', alignItems: 'start' }} > <Typography level="body-md">Joy UI</Typography> <Typography level="body-sm">Components that spark joy!</Typography> </Link> </Card> ); }
1,248
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/LinkCard.tsx.preview
<Card variant="outlined" sx={{ display: 'flex', gap: 2 }}> <Avatar size="lg" src="/static/images/avatar/1.jpg" /> <Link overlay href="#introduction" underline="none" sx={{ display: 'flex', flexDirection: 'column', alignItems: 'start' }} > <Typography level="body-md">Joy UI</Typography> <Typography level="body-sm">Components that spark joy!</Typography> </Link> </Card>
1,249
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/LinkColors.js
import * as React from 'react'; import Box from '@mui/joy/Box'; import Sheet from '@mui/joy/Sheet'; import Link from '@mui/joy/Link'; import RadioGroup from '@mui/joy/RadioGroup'; import Radio from '@mui/joy/Radio'; import Typography from '@mui/joy/Typography'; export default function LinkColors() { const [variant, setVariant] = React.useState('solid'); return ( <Box sx={{ display: 'flex', alignItems: 'center', gap: 3, }} > <Box sx={{ display: 'grid', gridTemplateColumns: 'repeat(2, minmax(0, 1fr))', gap: 2, }} > <Link href="#colors" variant={variant} color="primary"> Primary </Link> <Link href="#colors" variant={variant} color="neutral"> Neutral </Link> <Link href="#colors" variant={variant} color="danger"> Danger </Link> <Link href="#colors" variant={variant} color="success"> Success </Link> <Link href="#colors" variant={variant} color="warning"> Warning </Link> </Box> <Sheet sx={{ background: 'transparent', pl: 4, borderLeft: '1px solid', borderColor: 'divider', }} > <Typography level="body-sm" fontWeight="xl" id="variant-label" textColor="text.primary" mb={1} > Variant: </Typography> <RadioGroup size="sm" aria-labelledby="variant-label" name="variant" value={variant} onChange={(event) => setVariant(event.target.value)} > <Radio label="Solid" value="solid" /> <Radio label="Soft" value="soft" /> <Radio label="Outlined" value="outlined" /> <Radio label="Plain" value="plain" /> </RadioGroup> </Sheet> </Box> ); }
1,250
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/LinkColors.tsx
import * as React from 'react'; import Box from '@mui/joy/Box'; import Sheet from '@mui/joy/Sheet'; import Link from '@mui/joy/Link'; import RadioGroup from '@mui/joy/RadioGroup'; import Radio from '@mui/joy/Radio'; import Typography from '@mui/joy/Typography'; import { VariantProp } from '@mui/joy/styles'; export default function LinkColors() { const [variant, setVariant] = React.useState<VariantProp>('solid'); return ( <Box sx={{ display: 'flex', alignItems: 'center', gap: 3, }} > <Box sx={{ display: 'grid', gridTemplateColumns: 'repeat(2, minmax(0, 1fr))', gap: 2, }} > <Link href="#colors" variant={variant} color="primary"> Primary </Link> <Link href="#colors" variant={variant} color="neutral"> Neutral </Link> <Link href="#colors" variant={variant} color="danger"> Danger </Link> <Link href="#colors" variant={variant} color="success"> Success </Link> <Link href="#colors" variant={variant} color="warning"> Warning </Link> </Box> <Sheet sx={{ background: 'transparent', pl: 4, borderLeft: '1px solid', borderColor: 'divider', }} > <Typography level="body-sm" fontWeight="xl" id="variant-label" textColor="text.primary" mb={1} > Variant: </Typography> <RadioGroup size="sm" aria-labelledby="variant-label" name="variant" value={variant} onChange={(event) => setVariant(event.target.value as VariantProp)} > <Radio label="Solid" value="solid" /> <Radio label="Soft" value="soft" /> <Radio label="Outlined" value="outlined" /> <Radio label="Plain" value="plain" /> </RadioGroup> </Sheet> </Box> ); }
1,251
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/LinkDisabled.js
import * as React from 'react'; import Box from '@mui/joy/Box'; import Link from '@mui/joy/Link'; export default function LinkDisabled() { return ( <Box sx={{ display: 'flex', gap: 2, flexWrap: 'wrap' }}> <Link href="#disabled" disabled variant="solid"> Solid </Link> <Link href="#disabled" disabled variant="soft"> Soft </Link> <Link href="#disabled" disabled variant="outlined"> Outlined </Link> <Link href="#disabled" disabled variant="plain"> Plain </Link> </Box> ); }
1,252
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/LinkDisabled.tsx
import * as React from 'react'; import Box from '@mui/joy/Box'; import Link from '@mui/joy/Link'; export default function LinkDisabled() { return ( <Box sx={{ display: 'flex', gap: 2, flexWrap: 'wrap' }}> <Link href="#disabled" disabled variant="solid"> Solid </Link> <Link href="#disabled" disabled variant="soft"> Soft </Link> <Link href="#disabled" disabled variant="outlined"> Outlined </Link> <Link href="#disabled" disabled variant="plain"> Plain </Link> </Box> ); }
1,253
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/LinkDisabled.tsx.preview
<Link href="#disabled" disabled variant="solid"> Solid </Link> <Link href="#disabled" disabled variant="soft"> Soft </Link> <Link href="#disabled" disabled variant="outlined"> Outlined </Link> <Link href="#disabled" disabled variant="plain"> Plain </Link>
1,254
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/LinkLevels.js
import * as React from 'react'; import Box from '@mui/joy/Box'; import Link from '@mui/joy/Link'; export default function LinkLevels() { return ( <Box sx={{ display: 'flex', gap: 2, alignItems: 'center', flexWrap: 'wrap' }}> <Link href="#levels" level="h1"> H1 </Link> <Link href="#levels" level="h2"> H2 </Link> <Link href="#levels" level="h3"> H3 </Link> <Link href="#levels" level="h4"> H4 </Link> <Link href="#levels" level="title-lg"> Title Large </Link> <Link href="#levels" level="title-md"> Title Medium </Link> <Link href="#levels" level="title-sm"> Title Small </Link> <Link href="#levels" level="title-lg"> Body Large </Link> <Link href="#levels">Body Medium</Link> <Link href="#levels" level="body-sm"> Body Small </Link> <Link href="#levels" level="body-xs"> Body Extra Small </Link> </Box> ); }
1,255
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/LinkLevels.tsx
import * as React from 'react'; import Box from '@mui/joy/Box'; import Link from '@mui/joy/Link'; export default function LinkLevels() { return ( <Box sx={{ display: 'flex', gap: 2, alignItems: 'center', flexWrap: 'wrap' }}> <Link href="#levels" level="h1"> H1 </Link> <Link href="#levels" level="h2"> H2 </Link> <Link href="#levels" level="h3"> H3 </Link> <Link href="#levels" level="h4"> H4 </Link> <Link href="#levels" level="title-lg"> Title Large </Link> <Link href="#levels" level="title-md"> Title Medium </Link> <Link href="#levels" level="title-sm"> Title Small </Link> <Link href="#levels" level="title-lg"> Body Large </Link> <Link href="#levels">Body Medium</Link> <Link href="#levels" level="body-sm"> Body Small </Link> <Link href="#levels" level="body-xs"> Body Extra Small </Link> </Box> ); }
1,256
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/LinkUnderline.js
import * as React from 'react'; import Box from '@mui/joy/Box'; import Link from '@mui/joy/Link'; export default function LinkUnderline() { return ( <Box sx={{ display: 'flex', gap: 2, flexWrap: 'wrap' }}> <Link href="#underline" underline="always"> Always </Link> <Link href="#underline" underline="hover"> Hover </Link> <Link href="#underline" underline="none"> None </Link> </Box> ); }
1,257
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/LinkUnderline.tsx
import * as React from 'react'; import Box from '@mui/joy/Box'; import Link from '@mui/joy/Link'; export default function LinkUnderline() { return ( <Box sx={{ display: 'flex', gap: 2, flexWrap: 'wrap' }}> <Link href="#underline" underline="always"> Always </Link> <Link href="#underline" underline="hover"> Hover </Link> <Link href="#underline" underline="none"> None </Link> </Box> ); }
1,258
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/LinkUnderline.tsx.preview
<Link href="#underline" underline="always"> Always </Link> <Link href="#underline" underline="hover"> Hover </Link> <Link href="#underline" underline="none"> None </Link>
1,259
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/LinkUsage.js
import * as React from 'react'; import Link from '@mui/joy/Link'; import JoyUsageDemo from 'docs/src/modules/components/JoyUsageDemo'; export default function LinkUsage() { return ( <JoyUsageDemo componentName="Link" data={[ { propName: 'level', knob: 'select', options: [ 'h1', 'h2', 'h3', 'h4', 'title-lg', 'title-md', 'title-sm', 'body-lg', 'body-md', 'body-sm', 'body-xs', ], defaultValue: 'body-md', }, { propName: 'underline', knob: 'radio', options: ['hover', 'always', 'none'], defaultValue: 'hover', }, { propName: 'variant', knob: 'radio', options: ['plain', 'outlined', 'soft', 'solid'], }, { propName: 'color', knob: 'color', defaultValue: 'primary', }, { propName: 'disabled', knob: 'switch' }, ]} renderDemo={(props) => ( <Link {...props} href="#usage-props"> Anchor </Link> )} /> ); }
1,260
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/LinkVariants.js
import * as React from 'react'; import Link from '@mui/joy/Link'; import Box from '@mui/joy/Box'; export default function LinkVariants() { return ( <Box sx={{ display: 'flex', gap: 3, flexWrap: 'wrap' }}> <Link href="#variants">Link</Link> <Link href="#variants" variant="plain"> Link </Link> <Link href="#variants" variant="soft"> Link </Link> <Link href="#variants" variant="outlined"> Link </Link> <Link href="#variants" variant="solid"> Link </Link> </Box> ); }
1,261
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/LinkVariants.tsx
import * as React from 'react'; import Link from '@mui/joy/Link'; import Box from '@mui/joy/Box'; export default function LinkVariants() { return ( <Box sx={{ display: 'flex', gap: 3, flexWrap: 'wrap' }}> <Link href="#variants">Link</Link> <Link href="#variants" variant="plain"> Link </Link> <Link href="#variants" variant="soft"> Link </Link> <Link href="#variants" variant="outlined"> Link </Link> <Link href="#variants" variant="solid"> Link </Link> </Box> ); }
1,262
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/LinkVariants.tsx.preview
<Link href="#variants">Link</Link> <Link href="#variants" variant="plain"> Link </Link> <Link href="#variants" variant="soft"> Link </Link> <Link href="#variants" variant="outlined"> Link </Link> <Link href="#variants" variant="solid"> Link </Link>
1,263
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/link/link.md
--- productId: joy-ui title: React Link component components: Link githubLabel: 'component: link' waiAria: https://www.w3.org/WAI/ARIA/apg/patterns/link/ --- # Link <p class="description">The Link component lets you customize anchor tags with theme colors and typography styles.</p> {{"component": "modules/components/ComponentLinkHeader.js"}} ## Introduction The Joy UI Link component replaces the native HTML `<a>` element and accepts the same props as the [Typography](/joy-ui/react-typography/) component, as well as MUI System props. {{"demo": "LinkUsage.js", "hideToolbar": true, "bg": "gradient"}} ## Basics ```jsx import Link from '@mui/joy/Link'; ``` The Joy UI Link behaves similar to the native HTML `<a>`, so it renders with an underline by default and has no background color on hover. The demo below shows the two basic states available to the Link: default and disabled. Don't forget to always assign an `href` value: {{"demo": "BasicsLink.js"}} ## Customization ### Variants The Link component supports Joy UI's four global variants: `plain` (default), `soft`, `outlined`, and `solid`. :::warning Although the component is technically set to `plain` by default, it will actually render without any variant if you don't customize it. This is so that it adheres to the standard visual design of links on the web (no background color on hover). ::: {{"demo": "LinkVariants.js"}} :::info To learn how to add your own variants, check out [Themed components—Extend variants](/joy-ui/customization/themed-components/#extend-variants). Note that you lose the global variants when you add custom variants. ::: ### Levels The Link component comes with all the Typography levels to choose from. {{"demo": "LinkLevels.js"}} ### Colors Every palette included in the theme is available via the `color` prop. Play around combining different colors with different variants. {{"demo": "LinkColors.js"}} ### Underline Use the `underline` prop to control how the underline behaves on the Link component. It comes with three values: `hover`, `always`, and `none`. {{"demo": "LinkUnderline.js"}} ### Disabled Use the `disabled` prop to disable interaction and focus: {{"demo": "LinkDisabled.js"}} ### Overlay prop Use the `overlay` prop to make an entire component clickable as a link. The demo below shows how to use that with the Card component, ensuring proper accessibility. {{"demo": "LinkCard.js"}} ### As a button To use the Link component as a button, assign the `button` value to the `component` prop. This can be useful in two situations: 1. The link doesn't have a meaningful href. 2. The design looks more like a button than a link. ```js <Link component="button" onClick={() => { // ...process something }} > Do something </Link> ``` ### Usage with Typography The Link component can be used as a child of the [Typography](/joy-ui/react-typography/) component. In this situation, the Link will inherit the typographic level scale from its Typography parent, unless you specify a value for the `level` prop on the Link itself. {{"demo": "LinkAndTypography.js"}} ## Third-party routing library The sections below explain how to integrate the Link component with third-party tools that have their own comparable component. ### Next.js Pages Router Here is an example with the [Link component](https://nextjs.org/docs/pages/api-reference/components/link) of Next.js: ```js import NextLink from 'next/link'; import Link from '@mui/joy/Link'; <NextLink href="/docs" passHref> <Link>Read doc</Link> </NextLink>; ``` ### React Router Here is an example with the [Link component](https://reactrouter.com/en/main/components/link) of React Router: ```js import { Link as RouterLink } from 'react-router-dom'; import Link from '@mui/joy/Link'; <Link component={RouterLink} to="/docs"> Read doc </Link>; ``` ## Security When using `target="_blank"` with links to pages on another site, the [Google Chrome Developers documentation](https://developers.google.com/web/tools/lighthouse/audits/noopener) recommends adding `rel="noopener"` or `rel="noreferrer"` to avoid potential security issues. - `rel="noopener"` prevents the new page from being able to access the `window.opener` property and ensures it runs in a separate process. Without this, the target page can potentially redirect your page to a malicious URL. - `rel="noreferrer"` has the same effect, but also prevents the _Referer_ header from being sent to a new page. Note that removing the referrer header will affect analytics. ## Accessibility Here are a few tips for ensuring an accessible link component, based on [WAI-ARIA](https://www.w3.org/WAI/ARIA/apg/patterns/link/). - **Copywriting:** Avoid generic words as calls to action, such as "click here" or "go to". Instead, use [descriptive text](https://developers.google.com/web/tools/lighthouse/audits/descriptive-link-text) to inform the user about what they'll find when they click the link. - **Design:** For a good user experience, links should stand out from the text on the page. Keeping the default `underline="always"` behavior is a safe bet. - **Href:** If a link doesn't have a meaningful href, [it should be rendered using a `<button>` element](#as-button). ## Common examples Examples showcasing how to compose designs with the Link component and others as decorators. {{"demo": "DecoratorExamples.js"}}
1,264
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/ActionableList.js
import * as React from 'react'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import ListItemButton from '@mui/joy/ListItemButton'; import OpenInNew from '@mui/icons-material/OpenInNew'; import Info from '@mui/icons-material/Info'; export default function ActionableList() { return ( <List sx={{ maxWidth: 320, }} > <ListItem> <ListItemButton onClick={() => alert('You clicked')}> <ListItemDecorator> <Info /> </ListItemDecorator> Clickable item </ListItemButton> </ListItem> <ListItem> <ListItemButton component="a" href="#actionable"> <ListItemDecorator> <OpenInNew /> </ListItemDecorator> Open a new tab </ListItemButton> </ListItem> </List> ); }
1,265
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/ActionableList.tsx
import * as React from 'react'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import ListItemButton from '@mui/joy/ListItemButton'; import OpenInNew from '@mui/icons-material/OpenInNew'; import Info from '@mui/icons-material/Info'; export default function ActionableList() { return ( <List sx={{ maxWidth: 320, }} > <ListItem> <ListItemButton onClick={() => alert('You clicked')}> <ListItemDecorator> <Info /> </ListItemDecorator> Clickable item </ListItemButton> </ListItem> <ListItem> <ListItemButton component="a" href="#actionable"> <ListItemDecorator> <OpenInNew /> </ListItemDecorator> Open a new tab </ListItemButton> </ListItem> </List> ); }
1,266
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/BasicList.js
import * as React from 'react'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import Typography from '@mui/joy/Typography'; export default function BasicList() { return ( <div> <Typography id="basic-list-demo" level="body-xs" textTransform="uppercase" fontWeight="lg" > Ingredients </Typography> <List aria-labelledby="basic-list-demo"> <ListItem>1 red onion</ListItem> <ListItem>2 red peppers</ListItem> <ListItem>120g bacon</ListItem> </List> </div> ); }
1,267
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/BasicList.tsx
import * as React from 'react'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import Typography from '@mui/joy/Typography'; export default function BasicList() { return ( <div> <Typography id="basic-list-demo" level="body-xs" textTransform="uppercase" fontWeight="lg" > Ingredients </Typography> <List aria-labelledby="basic-list-demo"> <ListItem>1 red onion</ListItem> <ListItem>2 red peppers</ListItem> <ListItem>120g bacon</ListItem> </List> </div> ); }
1,268
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/BasicList.tsx.preview
<Typography id="basic-list-demo" level="body-xs" textTransform="uppercase" fontWeight="lg" > Ingredients </Typography> <List aria-labelledby="basic-list-demo"> <ListItem>1 red onion</ListItem> <ListItem>2 red peppers</ListItem> <ListItem>120g bacon</ListItem> </List>
1,269
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/DecoratedList.js
import * as React from 'react'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import Typography from '@mui/joy/Typography'; export default function DecoratedList() { return ( <div> <Typography id="decorated-list-demo" level="body-xs" textTransform="uppercase" fontWeight="lg" mb={1} > Ingredients </Typography> <List aria-labelledby="decorated-list-demo"> <ListItem> <ListItemDecorator>🧅</ListItemDecorator> 1 red onion </ListItem> <ListItem> <ListItemDecorator>🍤</ListItemDecorator> 2 Shrimps </ListItem> <ListItem> <ListItemDecorator>🥓</ListItemDecorator> 120g bacon </ListItem> </List> </div> ); }
1,270
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/DecoratedList.tsx
import * as React from 'react'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import Typography from '@mui/joy/Typography'; export default function DecoratedList() { return ( <div> <Typography id="decorated-list-demo" level="body-xs" textTransform="uppercase" fontWeight="lg" mb={1} > Ingredients </Typography> <List aria-labelledby="decorated-list-demo"> <ListItem> <ListItemDecorator>🧅</ListItemDecorator> 1 red onion </ListItem> <ListItem> <ListItemDecorator>🍤</ListItemDecorator> 2 Shrimps </ListItem> <ListItem> <ListItemDecorator>🥓</ListItemDecorator> 120g bacon </ListItem> </List> </div> ); }
1,271
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/DividedList.js
import * as React from 'react'; import Avatar from '@mui/joy/Avatar'; import Box from '@mui/joy/Box'; import List from '@mui/joy/List'; import ListDivider from '@mui/joy/ListDivider'; import ListItem from '@mui/joy/ListItem'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import Typography from '@mui/joy/Typography'; export default function DividedList() { return ( <Box sx={{ display: 'flex', flexWrap: 'wrap', justifyContent: 'center', gap: 4, }} > {[undefined, 'gutter', 'startDecorator', 'startContent'].map((inset) => ( <div key={inset || 'default'}> <Typography level="body-xs" mb={2}> <code>{inset ? `inset="${inset}"` : '(default)'}</code> </Typography> <List variant="outlined" sx={{ minWidth: 240, borderRadius: 'sm', }} > <ListItem> <ListItemDecorator> <Avatar size="sm" src="/static/images/avatar/1.jpg" /> </ListItemDecorator> Mabel Boyle </ListItem> <ListDivider inset={inset} /> <ListItem> <ListItemDecorator> <Avatar size="sm" src="/static/images/avatar/2.jpg" /> </ListItemDecorator> Boyd Burt </ListItem> </List> </div> ))} </Box> ); }
1,272
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/DividedList.tsx
import * as React from 'react'; import Avatar from '@mui/joy/Avatar'; import Box from '@mui/joy/Box'; import List from '@mui/joy/List'; import ListDivider from '@mui/joy/ListDivider'; import ListItem from '@mui/joy/ListItem'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import Typography from '@mui/joy/Typography'; export default function DividedList() { return ( <Box sx={{ display: 'flex', flexWrap: 'wrap', justifyContent: 'center', gap: 4, }} > {([undefined, 'gutter', 'startDecorator', 'startContent'] as const).map( (inset) => ( <div key={inset || 'default'}> <Typography level="body-xs" mb={2}> <code>{inset ? `inset="${inset}"` : '(default)'}</code> </Typography> <List variant="outlined" sx={{ minWidth: 240, borderRadius: 'sm', }} > <ListItem> <ListItemDecorator> <Avatar size="sm" src="/static/images/avatar/1.jpg" /> </ListItemDecorator> Mabel Boyle </ListItem> <ListDivider inset={inset} /> <ListItem> <ListItemDecorator> <Avatar size="sm" src="/static/images/avatar/2.jpg" /> </ListItemDecorator> Boyd Burt </ListItem> </List> </div> ), )} </Box> ); }
1,273
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/EllipsisList.js
import * as React from 'react'; import Avatar from '@mui/joy/Avatar'; import Box from '@mui/joy/Box'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListItemContent from '@mui/joy/ListItemContent'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import Typography from '@mui/joy/Typography'; export default function EllipsisList() { return ( <Box sx={{ width: 320 }}> <Typography id="ellipsis-list-demo" level="body-xs" textTransform="uppercase" sx={{ letterSpacing: '0.15rem' }} > Inbox </Typography> <List aria-labelledby="ellipsis-list-demo" sx={{ '--ListItemDecorator-size': '56px' }} > <ListItem> <ListItemDecorator> <Avatar src="/static/images/avatar/1.jpg" /> </ListItemDecorator> <ListItemContent> <Typography level="title-sm">Brunch this weekend?</Typography> <Typography level="body-sm" noWrap> I&apos;ll be in your neighborhood doing errands this Tuesday. </Typography> </ListItemContent> </ListItem> <ListItem> <ListItemDecorator> <Avatar src="/static/images/avatar/2.jpg" /> </ListItemDecorator> <ListItemContent> <Typography level="title-sm">Summer BBQ</Typography> <Typography level="body-sm" noWrap> Wish I could come, but I&apos;m out of town this Friday. </Typography> </ListItemContent> </ListItem> </List> </Box> ); }
1,274
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/EllipsisList.tsx
import * as React from 'react'; import Avatar from '@mui/joy/Avatar'; import Box from '@mui/joy/Box'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListItemContent from '@mui/joy/ListItemContent'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import Typography from '@mui/joy/Typography'; export default function EllipsisList() { return ( <Box sx={{ width: 320 }}> <Typography id="ellipsis-list-demo" level="body-xs" textTransform="uppercase" sx={{ letterSpacing: '0.15rem' }} > Inbox </Typography> <List aria-labelledby="ellipsis-list-demo" sx={{ '--ListItemDecorator-size': '56px' }} > <ListItem> <ListItemDecorator> <Avatar src="/static/images/avatar/1.jpg" /> </ListItemDecorator> <ListItemContent> <Typography level="title-sm">Brunch this weekend?</Typography> <Typography level="body-sm" noWrap> I&apos;ll be in your neighborhood doing errands this Tuesday. </Typography> </ListItemContent> </ListItem> <ListItem> <ListItemDecorator> <Avatar src="/static/images/avatar/2.jpg" /> </ListItemDecorator> <ListItemContent> <Typography level="title-sm">Summer BBQ</Typography> <Typography level="body-sm" noWrap> Wish I could come, but I&apos;m out of town this Friday. </Typography> </ListItemContent> </ListItem> </List> </Box> ); }
1,275
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/ExampleCollapsibleList.js
import * as React from 'react'; import Box from '@mui/joy/Box'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListItemButton, { listItemButtonClasses } from '@mui/joy/ListItemButton'; import IconButton from '@mui/joy/IconButton'; import Typography from '@mui/joy/Typography'; import ReceiptLong from '@mui/icons-material/ReceiptLong'; import KeyboardArrowDown from '@mui/icons-material/KeyboardArrowDown'; export default function ExampleCollapsibleList() { const [open, setOpen] = React.useState(false); const [open2, setOpen2] = React.useState(false); return ( <Box sx={{ width: 320, pl: '24px', }} > <List size="sm" sx={(theme) => ({ // Gatsby colors '--joy-palette-primary-plainColor': '#8a4baf', '--joy-palette-neutral-plainHoverBg': 'transparent', '--joy-palette-neutral-plainActiveBg': 'transparent', '--joy-palette-primary-plainHoverBg': 'transparent', '--joy-palette-primary-plainActiveBg': 'transparent', [theme.getColorSchemeSelector('dark')]: { '--joy-palette-text-secondary': '#635e69', '--joy-palette-primary-plainColor': '#d48cff', }, '--List-insetStart': '32px', '--ListItem-paddingY': '0px', '--ListItem-paddingRight': '16px', '--ListItem-paddingLeft': '21px', '--ListItem-startActionWidth': '0px', '--ListItem-startActionTranslateX': '-50%', [`& .${listItemButtonClasses.root}`]: { borderLeftColor: 'divider', }, [`& .${listItemButtonClasses.root}.${listItemButtonClasses.selected}`]: { borderLeftColor: 'currentColor', }, '& [class*="startAction"]': { color: 'var(--joy-palette-text-tertiary)', }, })} > <ListItem nested> <ListItem component="div" startAction={<ReceiptLong />}> <Typography level="body-xs" sx={{ textTransform: 'uppercase' }}> Documentation </Typography> </ListItem> <List sx={{ '--List-gap': '0px' }}> <ListItem> <ListItemButton selected>Overview</ListItemButton> </ListItem> </List> </ListItem> <ListItem sx={{ '--List-gap': '0px' }}> <ListItemButton>Quick Start</ListItemButton> </ListItem> <ListItem nested sx={{ my: 1 }} startAction={ <IconButton variant="plain" size="sm" color="neutral" onClick={() => setOpen(!open)} > <KeyboardArrowDown sx={{ transform: open ? 'initial' : 'rotate(-90deg)' }} /> </IconButton> } > <ListItem> <Typography level="inherit" sx={{ fontWeight: open ? 'bold' : undefined, color: open ? 'text.primary' : 'inherit', }} > Tutorial </Typography> <Typography component="span" level="body-xs"> 9 </Typography> </ListItem> {open && ( <List sx={{ '--ListItem-paddingY': '8px' }}> <ListItem> <ListItemButton>Overview</ListItemButton> </ListItem> <ListItem> <ListItemButton> 0. Set Up Your Development Environment </ListItemButton> </ListItem> <ListItem> <ListItemButton> 1. Create and Deploy Your First Gatsby Site </ListItemButton> </ListItem> <ListItem> <ListItemButton>2. Use and Style React components</ListItemButton> </ListItem> </List> )} </ListItem> <ListItem nested sx={{ my: 1 }} startAction={ <IconButton variant="plain" size="sm" color="neutral" onClick={() => setOpen2((bool) => !bool)} > <KeyboardArrowDown sx={{ transform: open2 ? 'initial' : 'rotate(-90deg)' }} /> </IconButton> } > <ListItem> <Typography level="inherit" sx={{ fontWeight: open2 ? 'bold' : undefined, color: open2 ? 'text.primary' : 'inherit', }} > How-to Guides </Typography> <Typography component="span" level="body-xs"> 39 </Typography> </ListItem> {open2 && ( <List sx={{ '--ListItem-paddingY': '8px' }}> <ListItem> <ListItemButton>Overview</ListItemButton> </ListItem> <ListItem> <ListItemButton>Local Development</ListItemButton> </ListItem> <ListItem> <ListItemButton>Routing</ListItemButton> </ListItem> <ListItem> <ListItemButton>Styling</ListItemButton> </ListItem> </List> )} </ListItem> </List> </Box> ); }
1,276
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/ExampleCollapsibleList.tsx
import * as React from 'react'; import Box from '@mui/joy/Box'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListItemButton, { listItemButtonClasses } from '@mui/joy/ListItemButton'; import IconButton from '@mui/joy/IconButton'; import Typography from '@mui/joy/Typography'; import ReceiptLong from '@mui/icons-material/ReceiptLong'; import KeyboardArrowDown from '@mui/icons-material/KeyboardArrowDown'; export default function ExampleCollapsibleList() { const [open, setOpen] = React.useState(false); const [open2, setOpen2] = React.useState(false); return ( <Box sx={{ width: 320, pl: '24px', }} > <List size="sm" sx={(theme) => ({ // Gatsby colors '--joy-palette-primary-plainColor': '#8a4baf', '--joy-palette-neutral-plainHoverBg': 'transparent', '--joy-palette-neutral-plainActiveBg': 'transparent', '--joy-palette-primary-plainHoverBg': 'transparent', '--joy-palette-primary-plainActiveBg': 'transparent', [theme.getColorSchemeSelector('dark')]: { '--joy-palette-text-secondary': '#635e69', '--joy-palette-primary-plainColor': '#d48cff', }, '--List-insetStart': '32px', '--ListItem-paddingY': '0px', '--ListItem-paddingRight': '16px', '--ListItem-paddingLeft': '21px', '--ListItem-startActionWidth': '0px', '--ListItem-startActionTranslateX': '-50%', [`& .${listItemButtonClasses.root}`]: { borderLeftColor: 'divider', }, [`& .${listItemButtonClasses.root}.${listItemButtonClasses.selected}`]: { borderLeftColor: 'currentColor', }, '& [class*="startAction"]': { color: 'var(--joy-palette-text-tertiary)', }, })} > <ListItem nested> <ListItem component="div" startAction={<ReceiptLong />}> <Typography level="body-xs" sx={{ textTransform: 'uppercase' }}> Documentation </Typography> </ListItem> <List sx={{ '--List-gap': '0px' }}> <ListItem> <ListItemButton selected>Overview</ListItemButton> </ListItem> </List> </ListItem> <ListItem sx={{ '--List-gap': '0px' }}> <ListItemButton>Quick Start</ListItemButton> </ListItem> <ListItem nested sx={{ my: 1 }} startAction={ <IconButton variant="plain" size="sm" color="neutral" onClick={() => setOpen(!open)} > <KeyboardArrowDown sx={{ transform: open ? 'initial' : 'rotate(-90deg)' }} /> </IconButton> } > <ListItem> <Typography level="inherit" sx={{ fontWeight: open ? 'bold' : undefined, color: open ? 'text.primary' : 'inherit', }} > Tutorial </Typography> <Typography component="span" level="body-xs"> 9 </Typography> </ListItem> {open && ( <List sx={{ '--ListItem-paddingY': '8px' }}> <ListItem> <ListItemButton>Overview</ListItemButton> </ListItem> <ListItem> <ListItemButton> 0. Set Up Your Development Environment </ListItemButton> </ListItem> <ListItem> <ListItemButton> 1. Create and Deploy Your First Gatsby Site </ListItemButton> </ListItem> <ListItem> <ListItemButton>2. Use and Style React components</ListItemButton> </ListItem> </List> )} </ListItem> <ListItem nested sx={{ my: 1 }} startAction={ <IconButton variant="plain" size="sm" color="neutral" onClick={() => setOpen2((bool) => !bool)} > <KeyboardArrowDown sx={{ transform: open2 ? 'initial' : 'rotate(-90deg)' }} /> </IconButton> } > <ListItem> <Typography level="inherit" sx={{ fontWeight: open2 ? 'bold' : undefined, color: open2 ? 'text.primary' : 'inherit', }} > How-to Guides </Typography> <Typography component="span" level="body-xs"> 39 </Typography> </ListItem> {open2 && ( <List sx={{ '--ListItem-paddingY': '8px' }}> <ListItem> <ListItemButton>Overview</ListItemButton> </ListItem> <ListItem> <ListItemButton>Local Development</ListItemButton> </ListItem> <ListItem> <ListItemButton>Routing</ListItemButton> </ListItem> <ListItem> <ListItemButton>Styling</ListItemButton> </ListItem> </List> )} </ListItem> </List> </Box> ); }
1,277
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/ExampleGmailList.js
import * as React from 'react'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListItemDecorator, { listItemDecoratorClasses, } from '@mui/joy/ListItemDecorator'; import ListItemContent from '@mui/joy/ListItemContent'; import ListItemButton from '@mui/joy/ListItemButton'; import Typography from '@mui/joy/Typography'; import Box from '@mui/joy/Box'; import ArrowDropDown from '@mui/icons-material/ArrowDropDown'; import InboxIcon from '@mui/icons-material/Inbox'; import Label from '@mui/icons-material/Label'; import People from '@mui/icons-material/People'; import Info from '@mui/icons-material/Info'; import Star from '@mui/icons-material/Star'; export default function ExampleGmailList() { const [index, setIndex] = React.useState(0); return ( <Box sx={{ py: 2, pr: 2, width: 320 }}> <List aria-label="Sidebar" sx={{ '--ListItem-paddingLeft': '0px', '--ListItemDecorator-size': '64px', '--ListItem-minHeight': '32px', '--List-nestedInsetStart': '13px', [`& .${listItemDecoratorClasses.root}`]: { justifyContent: 'flex-end', pr: '18px', }, '& [role="button"]': { borderRadius: '0 20px 20px 0', }, }} > <ListItem> <ListItemButton selected={index === 0} color={index === 0 ? 'primary' : undefined} onClick={() => setIndex(0)} > <ListItemDecorator> <InboxIcon fontSize="lg" /> </ListItemDecorator> <ListItemContent>Inbox</ListItemContent> <Typography level="body-sm" sx={{ fontWeight: 'bold', color: 'inherit' }} > 1,950 </Typography> </ListItemButton> </ListItem> <ListItem> <ListItemButton selected={index === 1} color={index === 1 ? 'neutral' : undefined} onClick={() => setIndex(1)} > <ListItemDecorator> <Star fontSize="lg" /> </ListItemDecorator> <ListItemContent>Starred</ListItemContent> </ListItemButton> </ListItem> <ListItem nested> <ListItemButton selected={index === 2} color={index === 2 ? 'success' : undefined} onClick={() => setIndex(2)} > <ListItemDecorator> <ArrowDropDown fontSize="lg" /> <Label fontSize="lg" /> </ListItemDecorator> Categories </ListItemButton> <List> <ListItem> <ListItemButton selected={index === 3} color={index === 3 ? 'primary' : undefined} onClick={() => setIndex(3)} > <ListItemDecorator> <People fontSize="lg" /> </ListItemDecorator> <ListItemContent>Social</ListItemContent> <Typography level="body-sm">4,320</Typography> </ListItemButton> </ListItem> <ListItem> <ListItemButton selected={index === 4} color={index === 4 ? 'warning' : undefined} onClick={() => setIndex(4)} > <ListItemDecorator> <Info fontSize="lg" /> </ListItemDecorator> <ListItemContent>Updates</ListItemContent> <Typography level="body-sm">22,252</Typography> </ListItemButton> </ListItem> </List> </ListItem> </List> </Box> ); }
1,278
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/ExampleGmailList.tsx
import * as React from 'react'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListItemDecorator, { listItemDecoratorClasses, } from '@mui/joy/ListItemDecorator'; import ListItemContent from '@mui/joy/ListItemContent'; import ListItemButton from '@mui/joy/ListItemButton'; import Typography from '@mui/joy/Typography'; import Box from '@mui/joy/Box'; import ArrowDropDown from '@mui/icons-material/ArrowDropDown'; import InboxIcon from '@mui/icons-material/Inbox'; import Label from '@mui/icons-material/Label'; import People from '@mui/icons-material/People'; import Info from '@mui/icons-material/Info'; import Star from '@mui/icons-material/Star'; export default function ExampleGmailList() { const [index, setIndex] = React.useState(0); return ( <Box sx={{ py: 2, pr: 2, width: 320 }}> <List aria-label="Sidebar" sx={{ '--ListItem-paddingLeft': '0px', '--ListItemDecorator-size': '64px', '--ListItem-minHeight': '32px', '--List-nestedInsetStart': '13px', [`& .${listItemDecoratorClasses.root}`]: { justifyContent: 'flex-end', pr: '18px', }, '& [role="button"]': { borderRadius: '0 20px 20px 0', }, }} > <ListItem> <ListItemButton selected={index === 0} color={index === 0 ? 'primary' : undefined} onClick={() => setIndex(0)} > <ListItemDecorator> <InboxIcon fontSize="lg" /> </ListItemDecorator> <ListItemContent>Inbox</ListItemContent> <Typography level="body-sm" sx={{ fontWeight: 'bold', color: 'inherit' }} > 1,950 </Typography> </ListItemButton> </ListItem> <ListItem> <ListItemButton selected={index === 1} color={index === 1 ? 'neutral' : undefined} onClick={() => setIndex(1)} > <ListItemDecorator> <Star fontSize="lg" /> </ListItemDecorator> <ListItemContent>Starred</ListItemContent> </ListItemButton> </ListItem> <ListItem nested> <ListItemButton selected={index === 2} color={index === 2 ? 'success' : undefined} onClick={() => setIndex(2)} > <ListItemDecorator> <ArrowDropDown fontSize="lg" /> <Label fontSize="lg" /> </ListItemDecorator> Categories </ListItemButton> <List> <ListItem> <ListItemButton selected={index === 3} color={index === 3 ? 'primary' : undefined} onClick={() => setIndex(3)} > <ListItemDecorator> <People fontSize="lg" /> </ListItemDecorator> <ListItemContent>Social</ListItemContent> <Typography level="body-sm">4,320</Typography> </ListItemButton> </ListItem> <ListItem> <ListItemButton selected={index === 4} color={index === 4 ? 'warning' : undefined} onClick={() => setIndex(4)} > <ListItemDecorator> <Info fontSize="lg" /> </ListItemDecorator> <ListItemContent>Updates</ListItemContent> <Typography level="body-sm">22,252</Typography> </ListItemButton> </ListItem> </List> </ListItem> </List> </Box> ); }
1,279
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/ExampleIOSList.js
import * as React from 'react'; import Avatar from '@mui/joy/Avatar'; import List from '@mui/joy/List'; import ListDivider from '@mui/joy/ListDivider'; import ListItem from '@mui/joy/ListItem'; import ListItemContent from '@mui/joy/ListItemContent'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import ListItemButton from '@mui/joy/ListItemButton'; import Typography from '@mui/joy/Typography'; import Sheet, { sheetClasses } from '@mui/joy/Sheet'; import Switch, { switchClasses } from '@mui/joy/Switch'; import KeyboardArrowRight from '@mui/icons-material/KeyboardArrowRightRounded'; import Flight from '@mui/icons-material/Flight'; import Wifi from '@mui/icons-material/Wifi'; import Bluetooth from '@mui/icons-material/Bluetooth'; import Podcasts from '@mui/icons-material/Podcasts'; export default function ExampleIOSList() { return ( <Sheet variant="soft" sx={{ width: 343, p: 2, borderRadius: 'sm' }}> <Typography level="h3" fontSize="xl2" fontWeight="xl" id="ios-example-demo" mb={1} > Settings </Typography> <List aria-labelledby="ios-example-demo" sx={(theme) => ({ '& ul': { '--List-gap': '0px', bgcolor: 'background.surface', '& > li:first-child > [role="button"]': { borderTopRightRadius: 'var(--List-radius)', borderTopLeftRadius: 'var(--List-radius)', }, '& > li:last-child > [role="button"]': { borderBottomRightRadius: 'var(--List-radius)', borderBottomLeftRadius: 'var(--List-radius)', }, }, '--List-radius': '8px', '--List-gap': '1rem', '--ListDivider-gap': '0px', '--ListItem-paddingY': '0.5rem', // override global variant tokens '--joy-palette-neutral-plainHoverBg': 'rgba(0 0 0 / 0.08)', '--joy-palette-neutral-plainActiveBg': 'rgba(0 0 0 / 0.12)', [theme.getColorSchemeSelector('light')]: { '--joy-palette-divider': 'rgba(0 0 0 / 0.08)', }, [theme.getColorSchemeSelector('dark')]: { '--joy-palette-neutral-plainHoverBg': 'rgba(255 255 255 / 0.1)', '--joy-palette-neutral-plainActiveBg': 'rgba(255 255 255 / 0.16)', }, })} > <ListItem nested> <List aria-label="Personal info" sx={{ '--ListItemDecorator-size': '72px' }} > <ListItem> <ListItemDecorator> <Avatar size="lg" sx={{ '--Avatar-size': '60px' }}> MB </Avatar> </ListItemDecorator> <div> <Typography fontSize="xl">Murphy Bates</Typography> <Typography fontSize="xs"> Apple ID, iCloud, Media & Purchase </Typography> </div> </ListItem> <ListDivider inset="startContent" /> <ListItem> <ListItemButton> <ListItemContent>iCloud+ Feature Updates</ListItemContent> <KeyboardArrowRight fontSize="xl3" /> </ListItemButton> </ListItem> </List> </ListItem> <ListItem nested> <ListItem sx={{ bgcolor: 'background.surface', mb: 1, borderRadius: 'var(--List-radius)', }} > <ListItemButton aria-describedby="apple-tv-description" sx={{ borderRadius: 'var(--List-radius)' }} > Apple TV+ Free Year Available </ListItemButton> </ListItem> <Typography id="apple-tv-description" level="body-xs" aria-hidden> Included with your recent Apple device purchase. Must be accepted within 90 days of activation. </Typography> </ListItem> <ListItem nested> <List aria-label="Network" sx={{ [`& .${sheetClasses.root}`]: { p: 0.5, lineHeight: 0, borderRadius: 'sm', }, }} > <ListItem> <ListItemDecorator> <Sheet variant="solid" color="warning"> <Flight /> </Sheet> </ListItemDecorator> <ListItemContent htmlFor="airplane-mode" component="label"> Airplane Mode </ListItemContent> <Switch id="airplane-mode" size="lg" color="success" sx={(theme) => ({ '--Switch-thumbShadow': '0 3px 7px 0 rgba(0 0 0 / 0.12)', '--Switch-thumbSize': '27px', '--Switch-trackWidth': '51px', '--Switch-trackHeight': '31px', '--Switch-trackBackground': theme.vars.palette.background.level3, [`& .${switchClasses.thumb}`]: { transition: 'width 0.2s, left 0.2s', }, '&:hover': { '--Switch-trackBackground': theme.vars.palette.background.level3, }, '&:active': { '--Switch-thumbWidth': '32px', }, [`&.${switchClasses.checked}`]: { '--Switch-trackBackground': 'rgb(48 209 88)', '&:hover': { '--Switch-trackBackground': 'rgb(48 209 88)', }, }, })} /> </ListItem> <ListDivider inset="startContent" /> <ListItem> <ListItemButton> <ListItemDecorator> <Sheet variant="solid" color="primary"> <Wifi /> </Sheet> </ListItemDecorator> <ListItemContent>Wi-Fi</ListItemContent> <Typography textColor="text.tertiary" sx={{ mr: 'calc(-1 * var(--ListItem-gap))' }} > Mars </Typography> <KeyboardArrowRight fontSize="xl3" /> </ListItemButton> </ListItem> <ListDivider inset="startContent" /> <ListItem> <ListItemButton> <ListItemDecorator> <Sheet variant="solid" color="primary"> <Bluetooth /> </Sheet> </ListItemDecorator> <ListItemContent>Bluetooth</ListItemContent> <Typography textColor="text.tertiary" sx={{ mr: 'calc(-1 * var(--ListItem-gap))' }} > On </Typography> <KeyboardArrowRight fontSize="xl3" /> </ListItemButton> </ListItem> <ListDivider inset="startContent" /> <ListItem> <ListItemButton> <ListItemDecorator> <Sheet variant="solid" color="success"> <Podcasts /> </Sheet> </ListItemDecorator> <ListItemContent>Cellular</ListItemContent> <KeyboardArrowRight fontSize="xl3" /> </ListItemButton> </ListItem> </List> </ListItem> </List> </Sheet> ); }
1,280
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/ExampleIOSList.tsx
import * as React from 'react'; import Avatar from '@mui/joy/Avatar'; import List from '@mui/joy/List'; import ListDivider from '@mui/joy/ListDivider'; import ListItem from '@mui/joy/ListItem'; import ListItemContent from '@mui/joy/ListItemContent'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import ListItemButton from '@mui/joy/ListItemButton'; import Typography from '@mui/joy/Typography'; import Sheet, { sheetClasses } from '@mui/joy/Sheet'; import Switch, { switchClasses } from '@mui/joy/Switch'; import KeyboardArrowRight from '@mui/icons-material/KeyboardArrowRightRounded'; import Flight from '@mui/icons-material/Flight'; import Wifi from '@mui/icons-material/Wifi'; import Bluetooth from '@mui/icons-material/Bluetooth'; import Podcasts from '@mui/icons-material/Podcasts'; export default function ExampleIOSList() { return ( <Sheet variant="soft" sx={{ width: 343, p: 2, borderRadius: 'sm' }}> <Typography level="h3" fontSize="xl2" fontWeight="xl" id="ios-example-demo" mb={1} > Settings </Typography> <List aria-labelledby="ios-example-demo" sx={(theme) => ({ '& ul': { '--List-gap': '0px', bgcolor: 'background.surface', '& > li:first-child > [role="button"]': { borderTopRightRadius: 'var(--List-radius)', borderTopLeftRadius: 'var(--List-radius)', }, '& > li:last-child > [role="button"]': { borderBottomRightRadius: 'var(--List-radius)', borderBottomLeftRadius: 'var(--List-radius)', }, }, '--List-radius': '8px', '--List-gap': '1rem', '--ListDivider-gap': '0px', '--ListItem-paddingY': '0.5rem', // override global variant tokens '--joy-palette-neutral-plainHoverBg': 'rgba(0 0 0 / 0.08)', '--joy-palette-neutral-plainActiveBg': 'rgba(0 0 0 / 0.12)', [theme.getColorSchemeSelector('light')]: { '--joy-palette-divider': 'rgba(0 0 0 / 0.08)', }, [theme.getColorSchemeSelector('dark')]: { '--joy-palette-neutral-plainHoverBg': 'rgba(255 255 255 / 0.1)', '--joy-palette-neutral-plainActiveBg': 'rgba(255 255 255 / 0.16)', }, })} > <ListItem nested> <List aria-label="Personal info" sx={{ '--ListItemDecorator-size': '72px' }} > <ListItem> <ListItemDecorator> <Avatar size="lg" sx={{ '--Avatar-size': '60px' }}> MB </Avatar> </ListItemDecorator> <div> <Typography fontSize="xl">Murphy Bates</Typography> <Typography fontSize="xs"> Apple ID, iCloud, Media & Purchase </Typography> </div> </ListItem> <ListDivider inset="startContent" /> <ListItem> <ListItemButton> <ListItemContent>iCloud+ Feature Updates</ListItemContent> <KeyboardArrowRight fontSize="xl3" /> </ListItemButton> </ListItem> </List> </ListItem> <ListItem nested> <ListItem sx={{ bgcolor: 'background.surface', mb: 1, borderRadius: 'var(--List-radius)', }} > <ListItemButton aria-describedby="apple-tv-description" sx={{ borderRadius: 'var(--List-radius)' }} > Apple TV+ Free Year Available </ListItemButton> </ListItem> <Typography id="apple-tv-description" level="body-xs" aria-hidden> Included with your recent Apple device purchase. Must be accepted within 90 days of activation. </Typography> </ListItem> <ListItem nested> <List aria-label="Network" sx={{ [`& .${sheetClasses.root}`]: { p: 0.5, lineHeight: 0, borderRadius: 'sm', }, }} > <ListItem> <ListItemDecorator> <Sheet variant="solid" color="warning"> <Flight /> </Sheet> </ListItemDecorator> <ListItemContent htmlFor="airplane-mode" component="label"> Airplane Mode </ListItemContent> <Switch id="airplane-mode" size="lg" color="success" sx={(theme) => ({ '--Switch-thumbShadow': '0 3px 7px 0 rgba(0 0 0 / 0.12)', '--Switch-thumbSize': '27px', '--Switch-trackWidth': '51px', '--Switch-trackHeight': '31px', '--Switch-trackBackground': theme.vars.palette.background.level3, [`& .${switchClasses.thumb}`]: { transition: 'width 0.2s, left 0.2s', }, '&:hover': { '--Switch-trackBackground': theme.vars.palette.background.level3, }, '&:active': { '--Switch-thumbWidth': '32px', }, [`&.${switchClasses.checked}`]: { '--Switch-trackBackground': 'rgb(48 209 88)', '&:hover': { '--Switch-trackBackground': 'rgb(48 209 88)', }, }, })} /> </ListItem> <ListDivider inset="startContent" /> <ListItem> <ListItemButton> <ListItemDecorator> <Sheet variant="solid" color="primary"> <Wifi /> </Sheet> </ListItemDecorator> <ListItemContent>Wi-Fi</ListItemContent> <Typography textColor="text.tertiary" sx={{ mr: 'calc(-1 * var(--ListItem-gap))' }} > Mars </Typography> <KeyboardArrowRight fontSize="xl3" /> </ListItemButton> </ListItem> <ListDivider inset="startContent" /> <ListItem> <ListItemButton> <ListItemDecorator> <Sheet variant="solid" color="primary"> <Bluetooth /> </Sheet> </ListItemDecorator> <ListItemContent>Bluetooth</ListItemContent> <Typography textColor="text.tertiary" sx={{ mr: 'calc(-1 * var(--ListItem-gap))' }} > On </Typography> <KeyboardArrowRight fontSize="xl3" /> </ListItemButton> </ListItem> <ListDivider inset="startContent" /> <ListItem> <ListItemButton> <ListItemDecorator> <Sheet variant="solid" color="success"> <Podcasts /> </Sheet> </ListItemDecorator> <ListItemContent>Cellular</ListItemContent> <KeyboardArrowRight fontSize="xl3" /> </ListItemButton> </ListItem> </List> </ListItem> </List> </Sheet> ); }
1,281
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/ExampleNavigationMenu.js
import * as React from 'react'; import { Popper } from '@mui/base/Popper'; import { ClickAwayListener } from '@mui/base/ClickAwayListener'; import Box from '@mui/joy/Box'; import IconButton from '@mui/joy/IconButton'; import Chip from '@mui/joy/Chip'; import List from '@mui/joy/List'; import ListDivider from '@mui/joy/ListDivider'; import ListItem from '@mui/joy/ListItem'; import ListItemContent from '@mui/joy/ListItemContent'; import ListItemButton from '@mui/joy/ListItemButton'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import HomeRounded from '@mui/icons-material/HomeRounded'; import KeyboardArrowDown from '@mui/icons-material/KeyboardArrowDown'; import Person from '@mui/icons-material/Person'; import Apps from '@mui/icons-material/Apps'; import FactCheck from '@mui/icons-material/FactCheck'; import BookmarkAdd from '@mui/icons-material/BookmarkAdd'; const useRovingIndex = (options) => { const { initialActiveIndex = 0, vertical = false, handlers = { onKeyDown: () => {}, }, } = options || {}; const [activeIndex, setActiveIndex] = React.useState(initialActiveIndex); const targetRefs = React.useRef([]); const targets = targetRefs.current; const focusNext = () => { let newIndex = activeIndex + 1; if (newIndex >= targets.length) { newIndex = 0; } targets[newIndex]?.focus(); setActiveIndex(newIndex); }; const focusPrevious = () => { let newIndex = activeIndex - 1; if (newIndex < 0) { newIndex = targets.length - 1; } targets[newIndex]?.focus(); setActiveIndex(newIndex); }; const getTargetProps = (index) => ({ ref: (ref) => { if (ref) { targets[index] = ref; } }, tabIndex: activeIndex === index ? 0 : -1, onKeyDown: (e) => { if (Number.isInteger(activeIndex)) { if (e.key === (vertical ? 'ArrowDown' : 'ArrowRight')) { focusNext(); } if (e.key === (vertical ? 'ArrowUp' : 'ArrowLeft')) { focusPrevious(); } handlers.onKeyDown?.(e, { setActiveIndex }); } }, onClick: () => { setActiveIndex(index); }, }); return { activeIndex, setActiveIndex, targets, getTargetProps, focusNext, focusPrevious, }; }; const AboutMenu = React.forwardRef(({ focusNext, focusPrevious, ...props }, ref) => { const [anchorEl, setAnchorEl] = React.useState(null); const { targets, setActiveIndex, getTargetProps } = useRovingIndex({ initialActiveIndex: null, vertical: true, handlers: { onKeyDown: (event, fns) => { if (event.key.match(/(ArrowDown|ArrowUp|ArrowLeft|ArrowRight)/)) { event.preventDefault(); } if (event.key === 'Tab') { setAnchorEl(null); fns.setActiveIndex(null); } if (event.key === 'ArrowLeft') { setAnchorEl(null); focusPrevious(); } if (event.key === 'ArrowRight') { setAnchorEl(null); focusNext(); } }, }, }); const open = Boolean(anchorEl); const id = open ? 'about-popper' : undefined; return ( <ClickAwayListener onClickAway={() => setAnchorEl(null)}> <div onMouseLeave={() => setAnchorEl(null)}> <ListItemButton aria-haspopup aria-expanded={open ? 'true' : 'false'} ref={ref} {...props} role="menuitem" onKeyDown={(event) => { props.onKeyDown?.(event); if (event.key.match(/(ArrowLeft|ArrowRight|Tab)/)) { setAnchorEl(null); } if (event.key === 'ArrowDown') { event.preventDefault(); targets[0]?.focus(); setActiveIndex(0); } }} onFocus={(event) => setAnchorEl(event.currentTarget)} onMouseEnter={(event) => { props.onMouseEnter?.(event); setAnchorEl(event.currentTarget); }} sx={(theme) => ({ ...(open && theme.variants.plainHover.neutral), })} > About <KeyboardArrowDown /> </ListItemButton> <Popper id={id} open={open} anchorEl={anchorEl} disablePortal keepMounted> <List role="menu" aria-label="About" variant="outlined" sx={{ my: 2, boxShadow: 'md', borderRadius: 'sm', '--List-radius': '8px', '--List-padding': '4px', '--ListDivider-gap': '4px', '--ListItemDecorator-size': '32px', }} > <ListItem role="none"> <ListItemButton role="menuitem" {...getTargetProps(0)}> <ListItemDecorator> <Apps /> </ListItemDecorator> Overview </ListItemButton> </ListItem> <ListItem role="none"> <ListItemButton role="menuitem" {...getTargetProps(1)}> <ListItemDecorator> <Person /> </ListItemDecorator> Administration </ListItemButton> </ListItem> <ListItem role="none"> <ListItemButton role="menuitem" {...getTargetProps(2)}> <ListItemDecorator> <FactCheck /> </ListItemDecorator> Facts </ListItemButton> </ListItem> </List> </Popper> </div> </ClickAwayListener> ); }); const AdmissionsMenu = React.forwardRef( ({ focusNext, focusPrevious, ...props }, ref) => { const [anchorEl, setAnchorEl] = React.useState(null); const { targets, setActiveIndex, getTargetProps } = useRovingIndex({ initialActiveIndex: null, vertical: true, handlers: { onKeyDown: (event, fns) => { if (event.key.match(/(ArrowDown|ArrowUp|ArrowLeft|ArrowRight)/)) { event.preventDefault(); } if (event.key === 'Tab') { setAnchorEl(null); fns.setActiveIndex(null); } if (event.key === 'ArrowLeft') { setAnchorEl(null); focusPrevious(); } if (event.key === 'ArrowRight') { setAnchorEl(null); focusNext(); } }, }, }); const open = Boolean(anchorEl); const id = open ? 'admissions-popper' : undefined; return ( <ClickAwayListener onClickAway={() => setAnchorEl(null)}> <div onMouseLeave={() => setAnchorEl(null)}> <ListItemButton aria-haspopup aria-expanded={open ? 'true' : 'false'} ref={ref} {...props} role="menuitem" onKeyDown={(event) => { props.onKeyDown?.(event); if (event.key.match(/(ArrowLeft|ArrowRight|Tab)/)) { setAnchorEl(null); } if (event.key === 'ArrowDown') { event.preventDefault(); targets[0]?.focus(); setActiveIndex(0); } }} onFocus={(event) => setAnchorEl(event.currentTarget)} onMouseEnter={(event) => { props.onMouseEnter?.(event); setAnchorEl(event.currentTarget); }} sx={(theme) => ({ ...(open && theme.variants.plainHover.neutral), })} > Admissions <KeyboardArrowDown /> </ListItemButton> <Popper id={id} open={open} anchorEl={anchorEl} disablePortal keepMounted> <List role="menu" aria-label="About" variant="outlined" sx={{ my: 2, boxShadow: 'md', borderRadius: 'sm', minWidth: 180, '--List-radius': '8px', '--List-padding': '4px', '--ListDivider-gap': '4px', }} > <ListItem role="none"> <ListItemButton role="menuitem" {...getTargetProps(0)}> <ListItemContent>Apply</ListItemContent> <Chip size="sm" variant="soft" color="danger"> Last 2 days! </Chip> </ListItemButton> </ListItem> <ListDivider /> <ListItem role="none"> <ListItemButton role="menuitem" {...getTargetProps(1)}> Visit </ListItemButton> </ListItem> <ListItem role="none" endAction={ <IconButton variant="outlined" color="neutral" size="sm"> <BookmarkAdd /> </IconButton> } > <ListItemButton role="menuitem" {...getTargetProps(2)}> Photo tour </ListItemButton> </ListItem> </List> </Popper> </div> </ClickAwayListener> ); }, ); export default function ExampleNavigationMenu() { const { targets, getTargetProps, setActiveIndex, focusNext, focusPrevious } = useRovingIndex(); return ( <Box sx={{ minHeight: 190 }}> <List role="menubar" orientation="horizontal" sx={{ '--List-radius': '8px', '--List-padding': '4px', '--List-gap': '8px', '--ListItem-gap': '0px', }} > <ListItem role="none"> <ListItemButton role="menuitem" {...getTargetProps(0)} component="a" href="#navigation-menu" > <ListItemDecorator> <HomeRounded /> </ListItemDecorator> Home </ListItemButton> </ListItem> <ListItem role="none"> <AboutMenu onMouseEnter={() => { setActiveIndex(1); targets[1].focus(); }} focusNext={focusNext} focusPrevious={focusPrevious} {...getTargetProps(1)} /> </ListItem> <ListItem role="none"> <AdmissionsMenu onMouseEnter={() => { setActiveIndex(2); targets[2].focus(); }} focusNext={focusNext} focusPrevious={focusPrevious} {...getTargetProps(2)} /> </ListItem> </List> </Box> ); }
1,282
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/ExampleNavigationMenu.tsx
import * as React from 'react'; import { Popper } from '@mui/base/Popper'; import { ClickAwayListener } from '@mui/base/ClickAwayListener'; import Box from '@mui/joy/Box'; import IconButton from '@mui/joy/IconButton'; import Chip from '@mui/joy/Chip'; import List from '@mui/joy/List'; import ListDivider from '@mui/joy/ListDivider'; import ListItem from '@mui/joy/ListItem'; import ListItemContent from '@mui/joy/ListItemContent'; import ListItemButton from '@mui/joy/ListItemButton'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import HomeRounded from '@mui/icons-material/HomeRounded'; import KeyboardArrowDown from '@mui/icons-material/KeyboardArrowDown'; import Person from '@mui/icons-material/Person'; import Apps from '@mui/icons-material/Apps'; import FactCheck from '@mui/icons-material/FactCheck'; import BookmarkAdd from '@mui/icons-material/BookmarkAdd'; type Options = { initialActiveIndex: null | number; vertical: boolean; handlers?: { onKeyDown: ( event: React.KeyboardEvent<HTMLAnchorElement>, fns: { setActiveIndex: React.Dispatch<React.SetStateAction<number | null>> }, ) => void; }; }; const useRovingIndex = (options?: Options) => { const { initialActiveIndex = 0, vertical = false, handlers = { onKeyDown: () => {}, }, } = options || {}; const [activeIndex, setActiveIndex] = React.useState<number | null>( initialActiveIndex!, ); const targetRefs = React.useRef<Array<HTMLAnchorElement>>([]); const targets = targetRefs.current; const focusNext = () => { let newIndex = activeIndex! + 1; if (newIndex >= targets.length) { newIndex = 0; } targets[newIndex]?.focus(); setActiveIndex(newIndex); }; const focusPrevious = () => { let newIndex = activeIndex! - 1; if (newIndex < 0) { newIndex = targets.length - 1; } targets[newIndex]?.focus(); setActiveIndex(newIndex); }; const getTargetProps = (index: number) => ({ ref: (ref: HTMLAnchorElement) => { if (ref) { targets[index] = ref; } }, tabIndex: activeIndex === index ? 0 : -1, onKeyDown: (e: React.KeyboardEvent<HTMLAnchorElement>) => { if (Number.isInteger(activeIndex)) { if (e.key === (vertical ? 'ArrowDown' : 'ArrowRight')) { focusNext(); } if (e.key === (vertical ? 'ArrowUp' : 'ArrowLeft')) { focusPrevious(); } handlers.onKeyDown?.(e, { setActiveIndex }); } }, onClick: () => { setActiveIndex(index); }, }); return { activeIndex, setActiveIndex, targets, getTargetProps, focusNext, focusPrevious, }; }; type AboutMenuProps = { focusNext: () => void; focusPrevious: () => void; onMouseEnter?: (event?: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void; onKeyDown?: (event: React.KeyboardEvent<HTMLAnchorElement>) => void; }; const AboutMenu = React.forwardRef( ( { focusNext, focusPrevious, ...props }: AboutMenuProps, ref: React.ForwardedRef<HTMLAnchorElement>, ) => { const [anchorEl, setAnchorEl] = React.useState<HTMLAnchorElement | null>(null); const { targets, setActiveIndex, getTargetProps } = useRovingIndex({ initialActiveIndex: null, vertical: true, handlers: { onKeyDown: (event, fns) => { if (event.key.match(/(ArrowDown|ArrowUp|ArrowLeft|ArrowRight)/)) { event.preventDefault(); } if (event.key === 'Tab') { setAnchorEl(null); fns.setActiveIndex(null); } if (event.key === 'ArrowLeft') { setAnchorEl(null); focusPrevious(); } if (event.key === 'ArrowRight') { setAnchorEl(null); focusNext(); } }, }, }); const open = Boolean(anchorEl); const id = open ? 'about-popper' : undefined; return ( <ClickAwayListener onClickAway={() => setAnchorEl(null)}> <div onMouseLeave={() => setAnchorEl(null)}> <ListItemButton aria-haspopup aria-expanded={open ? 'true' : 'false'} ref={ref} {...props} role="menuitem" onKeyDown={(event) => { props.onKeyDown?.(event); if (event.key.match(/(ArrowLeft|ArrowRight|Tab)/)) { setAnchorEl(null); } if (event.key === 'ArrowDown') { event.preventDefault(); targets[0]?.focus(); setActiveIndex(0); } }} onFocus={(event) => setAnchorEl(event.currentTarget)} onMouseEnter={(event) => { props.onMouseEnter?.(event); setAnchorEl(event.currentTarget); }} sx={(theme) => ({ ...(open && theme.variants.plainHover.neutral), })} > About <KeyboardArrowDown /> </ListItemButton> <Popper id={id} open={open} anchorEl={anchorEl} disablePortal keepMounted> <List role="menu" aria-label="About" variant="outlined" sx={{ my: 2, boxShadow: 'md', borderRadius: 'sm', '--List-radius': '8px', '--List-padding': '4px', '--ListDivider-gap': '4px', '--ListItemDecorator-size': '32px', }} > <ListItem role="none"> <ListItemButton role="menuitem" {...getTargetProps(0)}> <ListItemDecorator> <Apps /> </ListItemDecorator> Overview </ListItemButton> </ListItem> <ListItem role="none"> <ListItemButton role="menuitem" {...getTargetProps(1)}> <ListItemDecorator> <Person /> </ListItemDecorator> Administration </ListItemButton> </ListItem> <ListItem role="none"> <ListItemButton role="menuitem" {...getTargetProps(2)}> <ListItemDecorator> <FactCheck /> </ListItemDecorator> Facts </ListItemButton> </ListItem> </List> </Popper> </div> </ClickAwayListener> ); }, ); type AdmissionsMenuProps = { focusNext: () => void; focusPrevious: () => void; onMouseEnter?: (event?: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void; onKeyDown?: (event: React.KeyboardEvent<HTMLAnchorElement>) => void; }; const AdmissionsMenu = React.forwardRef( ( { focusNext, focusPrevious, ...props }: AdmissionsMenuProps, ref: React.ForwardedRef<HTMLAnchorElement>, ) => { const [anchorEl, setAnchorEl] = React.useState<HTMLAnchorElement | null>(null); const { targets, setActiveIndex, getTargetProps } = useRovingIndex({ initialActiveIndex: null, vertical: true, handlers: { onKeyDown: (event, fns) => { if (event.key.match(/(ArrowDown|ArrowUp|ArrowLeft|ArrowRight)/)) { event.preventDefault(); } if (event.key === 'Tab') { setAnchorEl(null); fns.setActiveIndex(null); } if (event.key === 'ArrowLeft') { setAnchorEl(null); focusPrevious(); } if (event.key === 'ArrowRight') { setAnchorEl(null); focusNext(); } }, }, }); const open = Boolean(anchorEl); const id = open ? 'admissions-popper' : undefined; return ( <ClickAwayListener onClickAway={() => setAnchorEl(null)}> <div onMouseLeave={() => setAnchorEl(null)}> <ListItemButton aria-haspopup aria-expanded={open ? 'true' : 'false'} ref={ref} {...props} role="menuitem" onKeyDown={(event) => { props.onKeyDown?.(event); if (event.key.match(/(ArrowLeft|ArrowRight|Tab)/)) { setAnchorEl(null); } if (event.key === 'ArrowDown') { event.preventDefault(); targets[0]?.focus(); setActiveIndex(0); } }} onFocus={(event) => setAnchorEl(event.currentTarget)} onMouseEnter={(event) => { props.onMouseEnter?.(event); setAnchorEl(event.currentTarget); }} sx={(theme) => ({ ...(open && theme.variants.plainHover.neutral), })} > Admissions <KeyboardArrowDown /> </ListItemButton> <Popper id={id} open={open} anchorEl={anchorEl} disablePortal keepMounted> <List role="menu" aria-label="About" variant="outlined" sx={{ my: 2, boxShadow: 'md', borderRadius: 'sm', minWidth: 180, '--List-radius': '8px', '--List-padding': '4px', '--ListDivider-gap': '4px', }} > <ListItem role="none"> <ListItemButton role="menuitem" {...getTargetProps(0)}> <ListItemContent>Apply</ListItemContent> <Chip size="sm" variant="soft" color="danger"> Last 2 days! </Chip> </ListItemButton> </ListItem> <ListDivider /> <ListItem role="none"> <ListItemButton role="menuitem" {...getTargetProps(1)}> Visit </ListItemButton> </ListItem> <ListItem role="none" endAction={ <IconButton variant="outlined" color="neutral" size="sm"> <BookmarkAdd /> </IconButton> } > <ListItemButton role="menuitem" {...getTargetProps(2)}> Photo tour </ListItemButton> </ListItem> </List> </Popper> </div> </ClickAwayListener> ); }, ); export default function ExampleNavigationMenu() { const { targets, getTargetProps, setActiveIndex, focusNext, focusPrevious } = useRovingIndex(); return ( <Box sx={{ minHeight: 190 }}> <List role="menubar" orientation="horizontal" sx={{ '--List-radius': '8px', '--List-padding': '4px', '--List-gap': '8px', '--ListItem-gap': '0px', }} > <ListItem role="none"> <ListItemButton role="menuitem" {...getTargetProps(0)} component="a" href="#navigation-menu" > <ListItemDecorator> <HomeRounded /> </ListItemDecorator> Home </ListItemButton> </ListItem> <ListItem role="none"> <AboutMenu onMouseEnter={() => { setActiveIndex(1); targets[1].focus(); }} focusNext={focusNext} focusPrevious={focusPrevious} {...getTargetProps(1)} /> </ListItem> <ListItem role="none"> <AdmissionsMenu onMouseEnter={() => { setActiveIndex(2); targets[2].focus(); }} focusNext={focusNext} focusPrevious={focusPrevious} {...getTargetProps(2)} /> </ListItem> </List> </Box> ); }
1,283
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/HorizontalDividedList.js
import * as React from 'react'; import Avatar from '@mui/joy/Avatar'; import List from '@mui/joy/List'; import ListDivider from '@mui/joy/ListDivider'; import ListItem from '@mui/joy/ListItem'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; export default function HorizontalDividedList() { return ( <List orientation="horizontal" variant="outlined" sx={{ flexGrow: 0, mx: 'auto', '--ListItemDecorator-size': '48px', '--ListItem-paddingY': '1rem', borderRadius: 'sm', }} > <ListItem> <ListItemDecorator> <Avatar size="sm" src="/static/images/avatar/1.jpg" /> </ListItemDecorator> Mabel Boyle </ListItem> <ListDivider inset="gutter" /> <ListItem> <ListItemDecorator> <Avatar size="sm" src="/static/images/avatar/2.jpg" /> </ListItemDecorator> Boyd Burt </ListItem> <ListDivider inset="gutter" /> <ListItem> <ListItemDecorator> <Avatar size="sm" src="/static/images/avatar/3.jpg" /> </ListItemDecorator> Adam Tris </ListItem> </List> ); }
1,284
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/HorizontalDividedList.tsx
import * as React from 'react'; import Avatar from '@mui/joy/Avatar'; import List from '@mui/joy/List'; import ListDivider from '@mui/joy/ListDivider'; import ListItem from '@mui/joy/ListItem'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; export default function HorizontalDividedList() { return ( <List orientation="horizontal" variant="outlined" sx={{ flexGrow: 0, mx: 'auto', '--ListItemDecorator-size': '48px', '--ListItem-paddingY': '1rem', borderRadius: 'sm', }} > <ListItem> <ListItemDecorator> <Avatar size="sm" src="/static/images/avatar/1.jpg" /> </ListItemDecorator> Mabel Boyle </ListItem> <ListDivider inset="gutter" /> <ListItem> <ListItemDecorator> <Avatar size="sm" src="/static/images/avatar/2.jpg" /> </ListItemDecorator> Boyd Burt </ListItem> <ListDivider inset="gutter" /> <ListItem> <ListItemDecorator> <Avatar size="sm" src="/static/images/avatar/3.jpg" /> </ListItemDecorator> Adam Tris </ListItem> </List> ); }
1,285
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/HorizontalList.js
import * as React from 'react'; import Box from '@mui/joy/Box'; import List from '@mui/joy/List'; import ListDivider from '@mui/joy/ListDivider'; import ListItem from '@mui/joy/ListItem'; import ListItemButton from '@mui/joy/ListItemButton'; import Home from '@mui/icons-material/Home'; import Person from '@mui/icons-material/Person'; export default function HorizontalList() { return ( <Box component="nav" aria-label="My site" sx={{ flexGrow: 1 }}> <List role="menubar" orientation="horizontal"> <ListItem role="none"> <ListItemButton role="menuitem" component="a" href="#horizontal-list" aria-label="Home" > <Home /> </ListItemButton> </ListItem> <ListDivider /> <ListItem role="none"> <ListItemButton role="menuitem" component="a" href="#horizontal-list"> Products </ListItemButton> </ListItem> <ListDivider /> <ListItem role="none"> <ListItemButton role="menuitem" component="a" href="#horizontal-list"> Blog </ListItemButton> </ListItem> <ListItem role="none" sx={{ marginInlineStart: 'auto' }}> <ListItemButton role="menuitem" component="a" href="#horizontal-list" aria-label="Profile" > <Person /> </ListItemButton> </ListItem> </List> </Box> ); }
1,286
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/HorizontalList.tsx
import * as React from 'react'; import Box from '@mui/joy/Box'; import List from '@mui/joy/List'; import ListDivider from '@mui/joy/ListDivider'; import ListItem from '@mui/joy/ListItem'; import ListItemButton from '@mui/joy/ListItemButton'; import Home from '@mui/icons-material/Home'; import Person from '@mui/icons-material/Person'; export default function HorizontalList() { return ( <Box component="nav" aria-label="My site" sx={{ flexGrow: 1 }}> <List role="menubar" orientation="horizontal"> <ListItem role="none"> <ListItemButton role="menuitem" component="a" href="#horizontal-list" aria-label="Home" > <Home /> </ListItemButton> </ListItem> <ListDivider /> <ListItem role="none"> <ListItemButton role="menuitem" component="a" href="#horizontal-list"> Products </ListItemButton> </ListItem> <ListDivider /> <ListItem role="none"> <ListItemButton role="menuitem" component="a" href="#horizontal-list"> Blog </ListItemButton> </ListItem> <ListItem role="none" sx={{ marginInlineStart: 'auto' }}> <ListItemButton role="menuitem" component="a" href="#horizontal-list" aria-label="Profile" > <Person /> </ListItemButton> </ListItem> </List> </Box> ); }
1,287
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/ListUsage.js
import * as React from 'react'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListItemContent from '@mui/joy/ListItemContent'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import ListItemButton from '@mui/joy/ListItemButton'; import HomeRoundedIcon from '@mui/icons-material/HomeRounded'; import ShoppingCartRoundedIcon from '@mui/icons-material/ShoppingCartRounded'; import KeyboardArrowRight from '@mui/icons-material/KeyboardArrowRight'; import JoyUsageDemo, { prependLinesSpace, } from 'docs/src/modules/components/JoyUsageDemo'; export default function ListUsage() { return ( <JoyUsageDemo componentName="ListItemButton" data={[ { propName: 'variant', knob: 'radio', options: ['plain', 'outlined', 'soft', 'solid'], defaultValue: 'plain', }, { propName: 'color', knob: 'color', defaultValue: 'neutral', }, { propName: 'selected', knob: 'switch', defaultValue: false, }, { propName: 'disabled', knob: 'switch', defaultValue: false, }, { propName: 'children', defaultValue: `<ListItemDecorator><Home /></ListItemDecorator> <ListItemContent>Home</ListItemContent> <KeyboardArrowRight />`, }, ]} getCodeBlock={(code) => `<List> <ListItem> ${prependLinesSpace(code, 3)} </ListItem> </List>`} renderDemo={(props) => ( <List sx={{ width: 240, my: 5 }}> <ListItem> <ListItemButton {...props}> <ListItemDecorator> <HomeRoundedIcon /> </ListItemDecorator> <ListItemContent>Home</ListItemContent> <KeyboardArrowRight /> </ListItemButton> </ListItem> <ListItem> <ListItemButton {...props}> <ListItemDecorator> <ShoppingCartRoundedIcon /> </ListItemDecorator> <ListItemContent>Orders</ListItemContent> <KeyboardArrowRight /> </ListItemButton> </ListItem> </List> )} /> ); }
1,288
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/ListVariables.js
import * as React from 'react'; import Avatar from '@mui/joy/Avatar'; import IconButton from '@mui/joy/IconButton'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListItemButton from '@mui/joy/ListItemButton'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import ListDivider from '@mui/joy/ListDivider'; import Typography from '@mui/joy/Typography'; import Sheet from '@mui/joy/Sheet'; import Home from '@mui/icons-material/Home'; import Apps from '@mui/icons-material/Apps'; import MoreVert from '@mui/icons-material/MoreVert'; import JoyVariablesDemo from 'docs/src/modules/components/JoyVariablesDemo'; export default function ListVariables() { return ( <JoyVariablesDemo componentName="List" childrenAccepted data={[ { var: '--List-padding', defaultValue: '0px' }, { var: '--List-radius', defaultValue: '0px' }, { var: '--List-gap', defaultValue: '0px' }, { var: '--ListItem-minHeight', defaultValue: '40px' }, { var: '--ListItem-paddingY', defaultValue: '6px' }, { var: '--ListItem-paddingX', defaultValue: '12px' }, { var: '--ListItemDecorator-size', defaultValue: '40px' }, { var: '--ListDivider-gap', defaultValue: '6px' }, ]} renderDemo={(sx) => ( <List sx={(theme) => ({ ...sx, width: 300, ...theme.variants.outlined.neutral, })} > <ListItem> <ListItemButton> <ListItemDecorator> <Home /> </ListItemDecorator> Home </ListItemButton> </ListItem> <ListItem> <ListItemButton> <ListItemDecorator> <Apps /> </ListItemDecorator> Products </ListItemButton> </ListItem> <ListDivider /> <ListItem nested> <ListItem> <Typography level="body-sm" fontWeight="md" startDecorator={ <Sheet component="span" sx={{ width: 8, height: 8, bgcolor: 'success.500', borderRadius: '50%', }} /> } > Online people </Typography> </ListItem> <List> <ListItem endAction={ <IconButton variant="plain" color="neutral" size="sm"> <MoreVert /> </IconButton> } > <ListItemButton> <ListItemDecorator sx={{ alignSelf: 'flex-start' }}> <Avatar size="sm" src="/static/images/avatar/1.jpg" /> </ListItemDecorator> Mabel Boyle </ListItemButton> </ListItem> <ListDivider inset="startContent" /> <ListItem endAction={ <IconButton variant="plain" color="neutral" size="sm"> <MoreVert /> </IconButton> } > <ListItemButton> <ListItemDecorator sx={{ alignSelf: 'flex-start' }}> <Avatar size="sm" src="/static/images/avatar/2.jpg" /> </ListItemDecorator> Boyd Burt </ListItemButton> </ListItem> </List> </ListItem> </List> )} /> ); }
1,289
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/MarkerList.js
import * as React from 'react'; import ToggleButtonGroup from '@mui/joy/ToggleButtonGroup'; import Button from '@mui/joy/Button'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import Stack from '@mui/joy/Stack'; export default function MarkerList() { const [type, setType] = React.useState('disc'); return ( <Stack spacing={2}> <ToggleButtonGroup value={type} onChange={(event, newValue) => setType(newValue || undefined)} > <Button value="disc">disc</Button> <Button value="circle">circle</Button> <Button value="decimal">decimal</Button> <Button value="upper-roman">upper-roman</Button> </ToggleButtonGroup> <List marker={type}> <ListItem>The Shawshank Redemption</ListItem> <ListItem nested> <ListItem>Star Wars</ListItem> <List marker="circle"> <ListItem>Episode I – The Phantom Menace</ListItem> <ListItem>Episode II – Attack of the Clones</ListItem> <ListItem>Episode III – Revenge of the Sith</ListItem> </List> </ListItem> <ListItem>The Lord of the Rings: The Two Towers</ListItem> </List> </Stack> ); }
1,290
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/MarkerList.tsx
import * as React from 'react'; import ToggleButtonGroup from '@mui/joy/ToggleButtonGroup'; import Button from '@mui/joy/Button'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import Stack from '@mui/joy/Stack'; export default function MarkerList() { const [type, setType] = React.useState<string | undefined>('disc'); return ( <Stack spacing={2}> <ToggleButtonGroup value={type} onChange={(event, newValue) => setType(newValue || undefined)} > <Button value="disc">disc</Button> <Button value="circle">circle</Button> <Button value="decimal">decimal</Button> <Button value="upper-roman">upper-roman</Button> </ToggleButtonGroup> <List marker={type}> <ListItem>The Shawshank Redemption</ListItem> <ListItem nested> <ListItem>Star Wars</ListItem> <List marker="circle"> <ListItem>Episode I – The Phantom Menace</ListItem> <ListItem>Episode II – Attack of the Clones</ListItem> <ListItem>Episode III – Revenge of the Sith</ListItem> </List> </ListItem> <ListItem>The Lord of the Rings: The Two Towers</ListItem> </List> </Stack> ); }
1,291
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/NavList.js
import * as React from 'react'; import List from '@mui/joy/List'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import ListItemButton from '@mui/joy/ListItemButton'; import Videocam from '@mui/icons-material/Videocam'; import Image from '@mui/icons-material/Image'; export default function NavList() { return ( <List component="nav" sx={{ maxWidth: 320, }} > <ListItemButton> <ListItemDecorator> <Image /> </ListItemDecorator> Add another image </ListItemButton> <ListItemButton> <ListItemDecorator> <Videocam /> </ListItemDecorator> Add another video </ListItemButton> </List> ); }
1,292
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/NavList.tsx
import * as React from 'react'; import List from '@mui/joy/List'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import ListItemButton from '@mui/joy/ListItemButton'; import Videocam from '@mui/icons-material/Videocam'; import Image from '@mui/icons-material/Image'; export default function NavList() { return ( <List component="nav" sx={{ maxWidth: 320, }} > <ListItemButton> <ListItemDecorator> <Image /> </ListItemDecorator> Add another image </ListItemButton> <ListItemButton> <ListItemDecorator> <Videocam /> </ListItemDecorator> Add another video </ListItemButton> </List> ); }
1,293
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/NestedList.js
import * as React from 'react'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListSubheader from '@mui/joy/ListSubheader'; import ListItemButton from '@mui/joy/ListItemButton'; import Typography from '@mui/joy/Typography'; import Switch from '@mui/joy/Switch'; export default function NestedList() { const [small, setSmall] = React.useState(false); return ( <div> <Switch size="sm" checked={small} onChange={(event) => setSmall(event.target.checked)} endDecorator={ <Typography level="body-sm">Toggle small nested list</Typography> } sx={{ mb: 2 }} /> <List variant="outlined" size={small ? 'sm' : undefined} sx={{ width: 200, borderRadius: 'sm', }} > <ListItem nested> <ListSubheader>Category 1</ListSubheader> <List> <ListItem> <ListItemButton>Subitem 1</ListItemButton> </ListItem> <ListItem> <ListItemButton>Subitem 2</ListItemButton> </ListItem> </List> </ListItem> <ListItem nested> <ListSubheader>Category 2</ListSubheader> <List> <ListItem> <ListItemButton>Subitem 1</ListItemButton> </ListItem> <ListItem> <ListItemButton>Subitem 2</ListItemButton> </ListItem> </List> </ListItem> </List> </div> ); }
1,294
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/NestedList.tsx
import * as React from 'react'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListSubheader from '@mui/joy/ListSubheader'; import ListItemButton from '@mui/joy/ListItemButton'; import Typography from '@mui/joy/Typography'; import Switch from '@mui/joy/Switch'; export default function NestedList() { const [small, setSmall] = React.useState(false); return ( <div> <Switch size="sm" checked={small} onChange={(event) => setSmall(event.target.checked)} endDecorator={ <Typography level="body-sm">Toggle small nested list</Typography> } sx={{ mb: 2 }} /> <List variant="outlined" size={small ? 'sm' : undefined} sx={{ width: 200, borderRadius: 'sm', }} > <ListItem nested> <ListSubheader>Category 1</ListSubheader> <List> <ListItem> <ListItemButton>Subitem 1</ListItemButton> </ListItem> <ListItem> <ListItemButton>Subitem 2</ListItemButton> </ListItem> </List> </ListItem> <ListItem nested> <ListSubheader>Category 2</ListSubheader> <List> <ListItem> <ListItemButton>Subitem 1</ListItemButton> </ListItem> <ListItem> <ListItemButton>Subitem 2</ListItemButton> </ListItem> </List> </ListItem> </List> </div> ); }
1,295
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/SecondaryList.js
import * as React from 'react'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListItemButton from '@mui/joy/ListItemButton'; import IconButton from '@mui/joy/IconButton'; import Add from '@mui/icons-material/Add'; import Delete from '@mui/icons-material/Delete'; export default function SecondaryList() { return ( <List sx={{ maxWidth: 300 }}> <ListItem startAction={ <IconButton aria-label="Add" size="sm" variant="plain" color="neutral"> <Add /> </IconButton> } > <ListItemButton>Item 1</ListItemButton> </ListItem> <ListItem endAction={ <IconButton aria-label="Delete" size="sm" color="danger"> <Delete /> </IconButton> } > <ListItemButton>Item 2</ListItemButton> </ListItem> </List> ); }
1,296
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/SecondaryList.tsx
import * as React from 'react'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListItemButton from '@mui/joy/ListItemButton'; import IconButton from '@mui/joy/IconButton'; import Add from '@mui/icons-material/Add'; import Delete from '@mui/icons-material/Delete'; export default function SecondaryList() { return ( <List sx={{ maxWidth: 300 }}> <ListItem startAction={ <IconButton aria-label="Add" size="sm" variant="plain" color="neutral"> <Add /> </IconButton> } > <ListItemButton>Item 1</ListItemButton> </ListItem> <ListItem endAction={ <IconButton aria-label="Delete" size="sm" color="danger"> <Delete /> </IconButton> } > <ListItemButton>Item 2</ListItemButton> </ListItem> </List> ); }
1,297
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/SelectedList.js
import * as React from 'react'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import ListItemButton from '@mui/joy/ListItemButton'; import Home from '@mui/icons-material/Home'; import Apps from '@mui/icons-material/Apps'; export default function SelectedList() { return ( <List sx={{ maxWidth: 320, }} > <ListItem> <ListItemButton selected> <ListItemDecorator> <Home /> </ListItemDecorator> Home </ListItemButton> </ListItem> <ListItem> <ListItemButton> <ListItemDecorator> <Apps /> </ListItemDecorator> Apps </ListItemButton> </ListItem> <ListItem> <ListItemButton> <ListItemDecorator /> Settings </ListItemButton> </ListItem> </List> ); }
1,298
0
petrpan-code/mui/material-ui/docs/data/joy/components
petrpan-code/mui/material-ui/docs/data/joy/components/list/SelectedList.tsx
import * as React from 'react'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import ListItemButton from '@mui/joy/ListItemButton'; import Home from '@mui/icons-material/Home'; import Apps from '@mui/icons-material/Apps'; export default function SelectedList() { return ( <List sx={{ maxWidth: 320, }} > <ListItem> <ListItemButton selected> <ListItemDecorator> <Home /> </ListItemDecorator> Home </ListItemButton> </ListItem> <ListItem> <ListItemButton> <ListItemDecorator> <Apps /> </ListItemDecorator> Apps </ListItemButton> </ListItem> <ListItem> <ListItemButton> <ListItemDecorator /> Settings </ListItemButton> </ListItem> </List> ); }
1,299