[locked] RFC: Buttons Standartization #2824
Replies: 1 comment 5 replies
-
Hey guys,
The KendoReact team is ok with renaming the class to Please share your thoughts on this @tapopov @Raisolution @zdravkov @jivanova @Xizario @VicTachev @nenchef |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Quick Overview
The main concept is described here: #1617
This discussion covers the Button and ButtonGroup.
In this discussion, we will write down the questions that arise during the process of standardizing the Buttons and the decisions we make. After all discussed cases are addressed, in the corresponding issue we will list the statements and the expected result of the task.
Now up to the new features:
New class
The Button will set
k-button
class by default.Fill Mode
We utilize the following main fill modes - solid, outline, flat, and link. The CSS classes for the same will be
k-button-solid
,k-button-outline
,k-button-flat
,k-button-link
.Sizes
We utilize 3 main sizes that will be used across components -
small
,medium
andlarge
. The CSS classes for the same will bek-button-sm
,k-button-md
,k-button-lg
.Shape
To produce shapes for the buttons there are 2 steps (render 2 CSS classes):
Utilize the base shape
To create only the base structure of the component, we will use component-specific classes. For example:
k-button-rectangle
andk-button-square
.shape
property sets only the base structure of the component.rectangle
- grows with the contentsquare
- have hard-coded dimensions (width = height)As the
aspect-ratio
is not supported for IE and Safari at this moment, we will go ahead and set bothaspect-ratio
and then calculatedwidth
andheight
of the element, so if the browser doesn't understand the first, it will fallback to the second styles. Once we drop the IE support, we can remove the hard-coded dimensions.Add additional border radius
We will use utility classes for setting the border-radius of the components. They will be:
k-rounded-sm
,k-rounded-md
,k-rounded-lg
,k-rounded-circle
(it will make the rectangular button as an elipse and square button as a circle). andk-rounded-pill
(it will make the rectangular button as a pill and square button as a circle as well).Additionally, we can implement other generic classes for rounding the sides separately and rounding the corners separately
Reference: https://tailwindcss.com/docs/border-radius.
If the users want to add custom rounding value, they can always use
style
property and setrounded
tonone
. For example (rounded square):.my-button-custom-shape { aspect-ratio: 1; border-radius: 7px; }
ThemeColor
We utilize 11 component-specific classes as theme colors -
k-button-solid-base
,k-button-solid-primary
,k-button-solid-secondary
,k-button-solid-tertiary
,k-button-solid-info
,k-button-solid-success
,k-button-solid-warning
,k-button-solid-error
,k-button-solid-dark
,k-button-solid-light
,k-button-solid-inverse
.The
none
conceptAs described above, all properties will have a
none
value which will remove the default set CSS class.In this case do we meet the Unstyled Components concept: https://material-ui.com/pt/customization/unstyled-components/. If yes, then we should promote it properly.
Rendering
Docs
TODO
Tests (visual)
Tests should be created in
tests/visual/src/reference/
folder as following:buttons/buttons-${suite}.html
dropdownbuttons/dropdownbuttons-${suite}.html
splitbuttons/splitbuttons-${suite}.html
Component API
In this section, we can think and write down the list of the props that will be added to the component. I'll start with the React Buttons:
Notes:
iconPosition
property allows rendering the icon before or after the text. It will not add any CSS class. Rather than that, the component will render the<span>
element with the icon either above the text or below it. Example:shape
and therounded
properties come hand-in-hand.shape
property sets only the base structure of the component. It's values will be:rectangle
- grows with the contentsquare
- have hard-coded dimensions (width = height)rounded
property will modify the border-radius to produce the desired shape. It's values will be:sm/md/lg
- applies 1px/2px/4px border radiuscircle
- makes the recrangle -> elipse, makes square -> circlepill
- square -> circle and rectangle -> pillPlayground
https://stackblitz.com/edit/react-uvyvdj?file=app%2Fmain.tsx
Beta Was this translation helpful? Give feedback.
All reactions