Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Providing status and labels for complex components / Composed Wrapper #168

Open
cooper-joe opened this issue Aug 19, 2020 · 0 comments
Open

Comments

@cooper-joe
Copy link
Member

@HendrikThePendric raised an important discussion on slack regarding composed inputs and how we can communicate their status and/or label. We discussed the issue shortly on slack, concluding that I would create a proposal for how to handle these situations. This is the proposal which is very much open for discussion.

Background

Input elements have error states and labels:
image-20200819104131781

These elements can be combined into a more complex component:
image-20200819104212820

However, there is no standard way of handling the status and the label of these organisms. Sometimes it may make sense to use the status of an component within the organism, but sometimes a general "There is something wrong with this component" status is needed:
image-20200819104302342

There are also situations where a label and/or help text would be useful:
image-20200819104325927

It would helpful to have a wrapper that provided these common functions. The label style should be customisable, there are too many different use-cases to define a single style that works everywhere.

The wrapper will not provide any validation, it's only function is as a utility to present the statuses and label. The anatomy of the wrapper is:
image-20200819105003018

Usage Examples

A complex expression builder component displays an error – it cannot be attributed to a specific element so it is only highlighted below:
image-20200819111422310

An organism that consists of a Transfer and checkboxes displays a label, generic error and a specific error:
image-20200819111911802

Three combined input/select fields display a label, help text, generic error and highlights a specific error with the last field:
image

Questions

  • Would we use this component to wrap complex components by default. For example, should the Transfer come wrapped by default to provide states and a label?
  • Could the design be more effective? An optional red background color would make the error belong more to the entire organism, rather than the bottom item. For example:
    image
    However, doing this would raise issues with margins and padding, so it would be another level of complexity to using this wrapper.
@varl varl transferred this issue from dhis2/ui Nov 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants