Replies: 2 comments
-
What kind of margin are you using. To reproduce your screenshot, I did used this code: <FormControl isInvalid={true}>
<Input value={"value"} mb={4} />
<FormControl.ErrorMessage leftIcon={<WarningOutlineIcon size="xs" />}>
{"This is an error message"}
</FormControl.ErrorMessage>
</FormControl>
<FormControl isInvalid={false}>
<Input value={"value"} mb={4} />
<FormControl.ErrorMessage leftIcon={<WarningOutlineIcon size="xs" />}>
{"This is an error message"}
</FormControl.ErrorMessage>
</FormControl> To fix it, you can move the margin to the parent <FormControl isInvalid={true} mb={4}>
<Input value={"value"} />
<FormControl.ErrorMessage leftIcon={<WarningOutlineIcon size="xs" />}>
{"This is an error message"}
</FormControl.ErrorMessage>
</FormControl>
<FormControl isInvalid={false} mb={4}>
<Input value={"value"} />
<FormControl.ErrorMessage leftIcon={<WarningOutlineIcon size="xs" />}>
{"This is an error message"}
</FormControl.ErrorMessage>
</FormControl> |
Beta Was this translation helpful? Give feedback.
0 replies
-
Here is a better example of what I'm talking about https://codesandbox.io/s/fld24?file=/src/components/Example.tsx See how the button jumps down when you press it and the error message appears. function Example() {
const [error, toggleError] = React.useState(false);
return (
<Column flex="1" p="4" w="80%" mt="4">
<FormControl isInvalid={error}>
<Input placeholder="Email" />
<FormControl.ErrorMessage>
Something went wrong
</FormControl.ErrorMessage>
</FormControl>
<Text>Next Item</Text>
<Button onPress={() => toggleError(!error)}>
Toggle Error
</Button>
</Column>
);
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm using something like this
The problem I'm having is that the spacing between my inputs changes depending on is there is an error or not
vs
Is there a sensible way to fix this, my hack is to make the formcontrol always invalid and to render an empyy message
Beta Was this translation helpful? Give feedback.
All reactions