Feedback on the Core cds-card
component
#6385
Replies: 3 comments 4 replies
-
Hi @astorije-vmware, Thank you for your feedback! I will take the chance to give some clarity on each point.
The
|
Beta Was this translation helpful? Give feedback.
-
@bbogdanov, with the recent release of checkbox panels and radio panels, is there an intension to match the designs eventually (borders, shadows, paddings)? vs. |
Beta Was this translation helpful? Give feedback.
-
The designs are different because they are fundamentally different components from an interaction perspective, meaning they have different a11y requirements. While cards are containers that may be used as needed, the radio / check panels are form elements that allow greater detail to be added to each available option. The need for different states and the consequent a11y contrast requirements in the latter leads to the visual differences you see. |
Beta Was this translation helpful? Give feedback.
-
Context
At CloudHealth, we've been converting our products to Clarity Core with React using the
@cds/core
and@cds/react
for a little over a year now.As part of that, we had converted our (non-Clarity) Card component to a Clarity-like card based on the Clarity Angular card component. Ours is a React component, so we created an API that we thought most resembles other Clarity Core components in order to:
CdsModal
or aCdsAlert
, using ourCard
component will look awfully familiar.This is what we have at the moment:
Screen.Recording.2021-10-07.at.3.58.21.PM.mov
And here is the code corresponding to those 2 cards:
and
Feedback
1. An interface closer to other Core components
This is how a card like the above would be implemented using the current API in preview:
A few things seem a little out of place compared to other Clarity Core components:
div
s with manual gaps, margins, etc. means there is very little chance all cards out there will share consistent styling. The need for flexibility is totally understandable, but no 2 cards should have different margins IMO.cds-card-remove-margin
prop forCdsDivider
seems a little too specific/one-off.Overall, we think an interface closer to modals or alerts would make a lot more sense. Selfishly, it would more closely match what we already have, but it would ensure consistent styling by abstracting things behind
cds-card-header
,cds-card-content
orcds-card-block
,cds-card-actions
orcds-card-footer
with built-in, consistent margins. It would also more closely match the other Clarity Core components.2. Automatic
id
/aria-labelledby
attribute generationAt the moment, it is necessary to pass those manually, but it would be super nice if those things could be automatically generated, similar to how
cds-input
treatslabel
/input
id generation 😍3. Auto-inlining flat buttons
I think it would be a neat idea if, when using
flat
buttons, they could be automatically turned intoinline-flat
buttons. There are definitely pros and cons to this, such as: what if one wants to use a mix of both outline + flat buttons, definitely don't want to auto-inline those, and then what if other cards next to that one only have flat buttons, probably worth leaving those.Not sure I'm fully sold on that one, but just throwing the idea out there for discussion, to help with consistency.
4. Border styling
This is obviously subjective and controversial, but the heavy shadow around cards feels a little... off.
As you can tell above, we have modeled our own
Card
component against the Angular cards (thin solid border + thick bottom border) and it overall looks "cleaner" and more "modern", however subjective those terms are.At CloudHealth, our design team tends to put most things inside a card and that would make for heavy designs.
Additionally, when co-locating a card aligned on top of a datagrid, an alert, or any other Core container that has a thin border, it will look uneven.
I know that this can be customized, but we overall do not customize our Clarity components unless we absolutely have to, in order to increase consistency within our own products (it's almost impossible to ensure every developer will implement customizations consistently across our codebases unless we provide a shared custom component), but also within other VMware products.
5. Clickable cards
Are they gone from Clarity? I'm assuming the accessibility of clickable cards is very hard to ensure and therefore the priority goes towards non-clickable cards with a call-to-action in the footer, could you confirm?
We are currently not using any clickable cards, so it's not going to be a problem not to have them in Core, but I want to make sure we communicate this internally if that's the case.
Thanks again for the wonderful work, we're excited to have yet another Core component taking over one of ours that we can slay! 😁
Beta Was this translation helpful? Give feedback.
All reactions