/
githubmirror
/
material-ui
Обзор
Документация
Войти
/
githubmirror
/
material-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
docs/data/material/getting-started/templates/checkout/components/AddressForm.js
134 строки
4 KB
Jan Potoms
[docs] Fix HTML validation errors (#48107)
31 мар 2026, 20:54
Не верифицирован
31 мар 2026, 20:54
d65dcfe
Код
Авторство
О чём код?
import Checkbox from '@mui/material/Checkbox'; import FormControlLabel from '@mui/material/FormControlLabel'; import FormLabel from '@mui/material/FormLabel'; import Grid from '@mui/material/Grid'; import OutlinedInput from '@mui/material/OutlinedInput'; import { styled } from '@mui/material/styles'; const FormGrid = styled(Grid)(() => ({ display: 'flex', flexDirection: 'column', })); export default function AddressForm() { return ( <Grid container spacing={3}> <FormGrid size={{ xs: 12, md: 6 }}> <FormLabel htmlFor="first-name" required> First name </FormLabel> <OutlinedInput id="first-name" name="first-name" type="text" placeholder="John" autoComplete="given-name" required size="small" /> </FormGrid> <FormGrid size={{ xs: 12, md: 6 }}> <FormLabel htmlFor="last-name" required> Last name </FormLabel> <OutlinedInput id="last-name" name="last-name" type="text" placeholder="Snow" autoComplete="family-name" required size="small" /> </FormGrid> <FormGrid size={{ xs: 12 }}> <FormLabel htmlFor="address1" required> Address line 1 </FormLabel> <OutlinedInput id="address1" name="address1" type="text" placeholder="Street name and number" autoComplete="shipping address-line1" required size="small" /> </FormGrid> <FormGrid size={{ xs: 12 }}> <FormLabel htmlFor="address2">Address line 2</FormLabel> <OutlinedInput id="address2" name="address2" type="text" placeholder="Apartment, suite, unit, etc. (optional)" autoComplete="shipping address-line2" required size="small" /> </FormGrid> <FormGrid size={{ xs: 6 }}> <FormLabel htmlFor="city" required> City </FormLabel> <OutlinedInput id="city" name="city" type="text" placeholder="New York" autoComplete="address-level2" required size="small" /> </FormGrid> <FormGrid size={{ xs: 6 }}> <FormLabel htmlFor="state" required> State </FormLabel> <OutlinedInput id="state" name="state" type="text" placeholder="NY" autoComplete="address-level1" required size="small" /> </FormGrid> <FormGrid size={{ xs: 6 }}> <FormLabel htmlFor="zip" required> Zip / Postal code </FormLabel> <OutlinedInput id="zip" name="zip" type="text" placeholder="12345" autoComplete="shipping postal-code" required size="small" /> </FormGrid> <FormGrid size={{ xs: 6 }}> <FormLabel htmlFor="country" required> Country </FormLabel> <OutlinedInput id="country" name="country" type="text" placeholder="United States" autoComplete="shipping country-name" required size="small" /> </FormGrid> <FormGrid size={{ xs: 12 }}> <FormControlLabel control={<Checkbox name="saveAddress" value="yes" />} label="Use this address for payment details" /> </FormGrid> </Grid> ); }