_invalid Input State Theming
See original GitHub issueDescription
Is there a reason this shouldn’t work?
export const chakraTheme = extendTheme({
components: {
FormLabel: {
defaultProps: { _invalid: { textColor: 'red.100' } },
},
},
});
It works fine as a prop on the component but I want to have it be a default.
Problem Statement/Justification
This is important as to not having to individually set _invalid
states on all components throughout a codebase. We should be able to theme it directly to apply to all components.
Proposed Solution or API
(see above snippet)
Alternatives
No response
Additional Information
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
invalid - CSS: Cascading Style Sheets - MDN Web Docs
The :invalid CSS pseudo-class represents any , , or other element whose contents fail to validate.
Read more >Form Validation Styling on Input Focus
If an input is not in focus, its placeholder text isn't shown, and the entered text is invalid… then you can use these...
Read more >How to target non-empty but invalid input elements with CSS
A clever CSS rule combining `:invalid` and `:placeholder-shown` to show validation state of non-empty input elements.
Read more >Validation in HTML5. :invalid classe after submit
When a user modifies a field you remove the class. In your CSS you then apply styling to input:not(.hide-hints):invalid . This means the...
Read more >Invalid Theme Warning - OutSystems 10 Documentation
Invalid Theme Warning ... Refer to the existing themes to check the necessary input parameters and entities that should be used in a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My apologies. I misunderstood your issue as I was going by your theme where you list
FormLabel
. You’re looking to set the border color for an Input when the input is invalid, correct?If so, then you need to look closely at the theme source.
You have two options for setting the border color for an invalid
Input
. Option 1: Set theerrorBorderColor
indefaultProps
Option 2: Set the value of
borderColor
andboxShadow
for_invalid
within the variant you are using, default isoutline
What is the recommended way of changing the error color theme-wide?
ie: the default error color in the base theme is
red.500
in light mode andred.300
in dark mode. I want to change it tored.400
for dark mode: do I have to set this forcolor
andborder
for theInput
s and theFormError
(duplicating a lot of code). or is there a more straightforward way of changing this?