Files
cloudbeaver/common-react/@dbeaver/ui-kit
Sychev Andreyandmr-anton-t a4102b28dd Feat/dbeaver/vscode#86/storybook integration (#3251)
* feat: add ui-kit package to common-react

* feat: add tailwind and ladle to ui-kit, use ui-kit in ce

* feat: create custom properties for button and checkbox using tailwind values as default

* feat: create simple button with 2 variants

* feat: create simple checkbox

* refactor: update after rebase

* feat: experiments with button and checkbox

* feat: add buttons sizes, adjust btn loader, add interactive story instead of many stories

* fix: add license

* fix: a11y issues with color contrast

* fix: mdx stories support

* feat: experiments with icons

* feat: try custom rendering

* docs: add small kinda docs for button

* refactor:  css layers

* chore: deps

* chore: remove buildinfo from git

* chore: remove tsbuildinfo from git

* fix: vertical tab overflow

* feat: use UIKit button as base for Cloudbeaver button

* fix: box-sizing problems

* refactor: button styles use BEM model

* refactor: separate base tokens from aliases

* refactor: add some defaults, write all properties in snake case

* refactor: rename button classes, add ui-kit prefix

* refactor: remove redundant story, omit a couple of props, add example to ladle

* refactor: add general sizes tokens, update license

* feat: add scaffold for input component

* refactor: update deps

* refactor: remove links

* refactor: change props naming, add prefixes in checkbox, removes validation nodes in input

* refactor: partially revert "feat: use UIKit button as base for Cloudbeaver button" to keep the old Button interface without changes

Original commit SHA: 62bb1fe9a0.

* Revert "refactor: update deps"

This reverts commit f7d6533967.

* refactor: update deps once again

* refactor: rename ui-kit prefix

* chore: update deps

* refactor: Button Icon Interface

* refactor: use JSDoc for placement comment

* refactor css custom props for Button

* refactor: introduce opacity custom property, fix icon margin property

* fix: button text should not wrap;

* fix: tailwindcss version

* fix: tailwindcss version

* refactor: remove checkbox styles, keep only wireframe

* refactor: move input-related css variables to the dedicated folder

* refactor: remove unused input props

* refactor: btn loader animation

* refactor: use nesting for states, refactor classnames using BEM delimiters

* refactor: introduce btn-border-width prop, removed redundant btn-padding-block since we use fixed heights

* refactor: input and button

* fix: input

* chore: deps

* chore: deps

* chore: add vite as dev dep

* refactor: button variants

* chore: yarn install

* fix: loading button should not react on hover

* docs: add stories about tokens

* chore:  remove lint command

* refactor: add prefix to css variables

* refactor: add base border-radius and border-width for controls

* fix: don't import tailwind in style files

* fix: add tailwindcss import for ladle

* fix: base radius variable

* refactor: rename css var

* refactor: add tw prefix for tailwind classes and vars

* fix: styles in easy-config

* fix: after tailwind reset paddings don't in width anymore, compensate

* fix: don't show outline on mouse click

* refactor: change btn state classes, remove not loading for hover because it's strange that button reacts on click when in loading state, but not on hover.

* fix: icons

* fix: add letter-spacing to normalize to prevent tailwind reset it with inherit value

* fix: welcome page selector

* fix: button outline uses a variable for width,  proper loading state in aria, icon class name

* feat: add global styles for UI-kit ladle

* docs: refactored stories composition, added stories

* refactor: simplify loader, enable custom loaders, introduced token for btn loader, fix class names, updated stories

* docs: add global styles for ladle

* feat: use custom loader in cloudbeaver

* refactor: use oklch color space for color mixing in loaders

* docs: add readme

* fix: tsconfig, format ladle config

* docs: add short command for ladle, update readme

* fix: module export

* build: add vite plugin

* fix: remove aria-label for loading

* fix: yarn

---------

Co-authored-by: mr-anton-t <42037741+mr-anton-t@users.noreply.github.com>
2025-02-25 21:04:57 +08:00
..

DBeaver UI Kit

The DBeaver UI Kit is a collection of reusable React components designed to help developers build consistent and visually appealing user interfaces.

Using Ladle for Component Development

Ladle is a tool that allows you to develop, test, and document your React components in isolation. We use it to create a sandbox environment where you can interact with your components and ensure they work as expected.

To get started with Ladle in the DBeaver UI Kit, write in terminal:

yarn docs

Then open the provided URL to see components.

How to Customize

DBeaver UI Kit components have basic styles and use some defaults from Tailwind CSS. To change styling, you can use different approaches.

Global CSS Tokens

The UI kit uses several global CSS tokens described on the Global Tokens page. These tokens help maintain consistency across the UI components. All DBeaver UI tokens are prefixed with --dbv-kit-. You can use these tokens to customize the UI kit to fit your application's design. For example, changing the --dbv-kit-font-size-base token will change the base font size for text in the UI kit. Changing the --dbv-kit-control-height-base token will change all control heights. If you don't want to change all controls, you can change --dbv-kit-control-height-small, --dbv-kit-control-height-medium, or other tokens separately. They will affect only specific components.

Component CSS Tokens

Some components have their own tokens. For example, the Button component has tokens for button sizes, padding, and colors. You can change these tokens to customize the Button component. To see the list of tokens, go to sources or start Ladle.

Component CSS Classes

Each component in the UI kit has a default CSS class name following the dbv-kit-[component name(in lowercase)] naming convention that you can use to customize the component. You can find the default class name in the component's documentation.

For button:

.dbv-kit-button {
  /* Your custom styles */
}

For input:

.dbv-kit-input {
  /* Your custom styles */
}

Some components have additional classes for different states or sizes. For example, the Button component has classes for different sizes: .dbv-kit-button--small, .dbv-kit-button--large. We use the BEM convention for class names. If a component has a modifier, it will be separated by two dashes. If a component has a child element, it will be separated by two underscores, for example:

  • .dbv-kit-button__icon - icon is a child element of the button
  • .dbv-kit-button--large - large is a size modifier
  • .dbv-kit-button__icon--start - icon is a child element of the button and has a start placement

Each component accepts the standard className and style props which enable using vanilla CSS, utility classes (e.g., Tailwind), CSS-in-JS (e.g., Styled Components), etc. A custom className can be specified and will be appended to a class list of a component:

<Button className="my-custom-button">Button</Button>
<Button style={{ background: 'red' }}>Button</Button>