We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import { forwardRef } from "react"; import { AddressSuggestions } from "react-dadata"; import { Box, OutlinedInput, styled } from "@mui/material"; const apiKey = import.meta.env.VITE_DADATA_API_KEY; const StyledInput = styled(OutlinedInput)({ fontSize: "14px", padding: "0px", border: "none", }); const Address = forwardRef< HTMLInputElement, { onChange: (event: { target: { value: string } }) => void } >(({ onChange }, ref) => { return ( <AddressSuggestions token={apiKey} onChange={(suggestion) => onChange({ target: { value: suggestion?.value || "" } }) } inputProps={{ placeholder: "Город отгрузки", required: true, }} customInput={StyledInput} /> ); }); export default function Autocomplete() { const handleAddressChange = (event: { target: { value: string } }) => { console.log("город:", event.target.value); }; return ( <Box sx={{ mt: 1 }}> <Address onChange={handleAddressChange} /> </Box> ); }
Есть такой компонент, как вывести не весь адрес, а только город? Кстати, этот компонент использует стили MUI TextField, если кому вдруг необходимо.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Есть такой компонент, как вывести не весь адрес, а только город?
Кстати, этот компонент использует стили MUI TextField, если кому вдруг необходимо.
The text was updated successfully, but these errors were encountered: