marigold-ui / marigold

Design System based on react-aria and Tailwind CSS
https://marigold-ui.io
MIT License
101 stars 7 forks source link

Form Revolution #1889

Closed sebald closed 2 years ago

sebald commented 2 years ago

Description

We have to go over the forms and unify their API!

New


Refactor

Bugs

Delete

API

Consequences

Easier to use forms in Marigold 🤞

sebald commented 2 years ago

@ti10le we could also change the import API like the following:

import { Field } from '@marigold/components';

<Field.Text/>
<Field.TextArea/>
<Field.Checkbox/>
<Field.Select/>

I could life with that 😅

sebald commented 2 years ago

What's the common API of Field Elements?

Plus the regular props that the form HTML element has

ti10le commented 2 years ago

This would be also good for me. Then we don't include the same things from field in every field component 😊 It would be clear that all of them a Field component.

sebald commented 2 years ago

Yes, exactly 😄 question is how we document this and structure it inside of @marigold/components.

Do we create a Field/Form folder and put everything there?

ti10le commented 2 years ago

I would create a folder for every component like now but dont show the Field component in docs or storybook. Only together with the other part. Not all inside Field i think 🤔

sebald commented 2 years ago

Might be confusing for imports

ti10le commented 2 years ago

Why? Not publishing the Field folder

sebald commented 2 years ago

Why? Not publishing the Field folder

@ti10le not sure what do you mean.

I think our project structure has to reflect export, otherwise you'll have a hard time finding things. This would also mean that if we separate stuff in the documentation (e.g. forms, layout, content, ...) this should be reflected in side the project.

ti10le commented 2 years ago

Ok I think the way you want to do this would be good for me, too 😊

ti10le commented 2 years ago

ℹī¸ Note for later: Field.tsx and HelpText.tsx are not tested enough. Coverage is not 100%

ti10le commented 2 years ago

I would make only a <RadioGroup /> component. The most DS have only the Group. Because you should never use an Radio standalone.