gcanti / tcomb-form

Forms library for react
https://gcanti.github.io/tcomb-form
MIT License
1.16k stars 136 forks source link

'required' property #208

Closed benmonro closed 8 years ago

benmonro commented 8 years ago

I want to render a little red * next to required fields. As far as I can tell the way to check this is like so:

        var required = locals.myInput.props.type.name !== 'Maybe';

It would be nice to instead just have a cleaner syntax like this:

  <div>{locals.myInput.props.type.required && <span>*</span>}</div>
gcanti commented 8 years ago

A more reliable way would be to test the meta object:

var required = ( type.meta.kind !== 'maybe' );
gcanti commented 8 years ago

Closing in favour of #210