Comments (4)
@antemarkic Thanks for the suggestion. We did this in vue formulate by adding a data attribute data-is-valid
, and data-has-error
this is nice because it leaves the class system free/clear for people who want to write their own class solutions. We could pretty easily re-create that same tooling here in FormKit.
Letβs add it to the roadmap.
from formkit.
@antemarkic this is release-ready and will be published with 1.0.0-beta.3
. Here's an example of it running on beta.3:
https://formkit.link/cb85162e120c9de18e0298dbd8ca849e
Basic rules:
data-complete
True when these conditions are met:
Either:
- The input has validation rules
- The validation rules are all passing
- There are no errors on the input
Or: - The input has no validation rules
- The input has no errors
- The input is dirty and has a value
This is not intended to be used on forms/groups/lists but instead on individual inputs. Imagine placing a green checkbox next to each input when the user filled it out correctly β thats what these are for.
data-invalid
Added when the input has failing validation messages and those messages are being displayed !context.state.valid && context.state.validationVisible
data-errors
Added whenever explicitly set errors are on the input, either via a parent (like setErrors()
from the form), or directly via the :errors
prop.
from formkit.
Hi, @justin-schroeder.
While adding built-in attributes is a nice feature, If message uses the transition tag, the style changes ugly, is there any way to add a custom class?
I'm sorry, that's what I wanted to say yesterday. Now that I've handled the transition hook manually, it would be nice to have a built-in API
from formkit.
You can modify this behavior on your own β although I'm still not exactly sure what behavior you're looking to modify. Perhaps you could make a playground at https://formkit.com/playground with an example of the transition you are attempting and what you are wanting to achieve and then I can assist from there. Thanks @aegorx!
from formkit.
Related Issues (20)
- [TypeScript] - Custom input props bad boolean type HOT 1
- 'destroying' event doesn't fire on repeater element removal HOT 1
- Improvement to german Translation
- Installing packages returns warning with unocss HOT 2
- Icons broken when using Nuxt HOT 2
- Formkit Number in Float mode fails to submit HOT 1
- Components that wrap named-slotted components don't resolve with `autoImport` HOT 2
- Custom icon-loader is not called for default default internal icon names.
- Add option to Colorpicker to disable alpha channel
- Auto-import common types in Nuxt (like `FormKitNode`) HOT 6
- Can't unselect option by click when I searched for it HOT 1
- Taglist options wrong position when searching HOT 1
- Type error for attribute that is used to set inital value(value) HOT 8
- Dropdown Popover: Non-text id leads to "is not a valid selector" HOT 1
- Performance when loading hundreds of inputs HOT 2
- Mask does not fulfill browser's autofill
- Autocomplete input doesn't update its options correctly HOT 3
- Custom @remove-icon-click function doesn't override native remove handler HOT 6
- Datepicker cannot parse escaped tokens
- i18n - add language - Macedonian HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from formkit.