Files
cloudbeaver/common-react/@dbeaver/ui-kit
Sychev Andreyandmr-anton-t c3be008ba2 dbeaver/pro#6283 Add Combobox component (#3597)
* dbeaver/pro#6283 feat: add simple Combobox implementation

It has fuzzy search inside to filter items.

* dbeaver/pro#6283 feat: implement Combobox component with search functionality and update related files

* dbeaver/pro#6283 refactor: remove unused onChange prop

* dbeaver/pro#6283 style: update imports in Combobox component

* dbeaver/pro#6283 feat: update styles, add popoverClassName prop

* dbeaver/pro#6283 refactor: keep Combobox composable for better control

* dbeaver/pro#6283 refactor: SRP in Combobox, split provider and components

* dbeaver/pro#6283 feat: implement advanced search

see AdvancedSearch example in stories

* dbeaver/pro#6283 refactor: use strict comparison

* dbeaver/pro#6283 refactor: replace fuzzy search with standard string search

* dbeaver/pro#6283 refactor: simplify Combobox component

* dbeaver/pro#6283 feat: add value formatter for ComboboxInput

It might be useful for cases when value is not in user friendly format. Combobox doesn't support such transformations from the box

Updated examples, added valueFormatter to advanced search, added MultiSelect example

* dbeaver/pro#6283 feat: sync styles with select

* dbeaver/pro#6283 fix: formatter

* dbeaver/pro#6283 fix: respect the user's reduce motion preference

* dbeaver/pro#6283 refactor: simplify component

remove search context,
use some built-in features for input value manipulations and for auto selection of the first item

* dbeaver/pro#6283 refactor: use tailwind for Field styles

* dbeaver/pro#6283 fix: should open all options on first interaction with any value

* dbeaver/pro#6283 refactor: strip Combobox component

Due to difficulties with items and search value managing in Combobox using only native combobox store, it was decided to move all that logic to CloudBeaver combobox component.

This commit removes all the logic from UIKit Combobox and partially restores it in Cloudbeaver Combobox

* dbeaver/pro#6283 feat: show no results when no items

* dbeaver/pro#6283 feat: restore input to the last valid value

* dbeaver/pro#6283 refactor: simplify restore input logic

* dbeaver/pro#6283 refactor: reset input value on blur

* dbeaver/pro#6283 refactor: don't sent input value on item click

* dbeaver/pro#6283 refactor: remove getComputed for filteredItems

getComputed will not work as expected for not primitive values( for example, for arrays)

* dbeaver/pro#6283 refactor: remove getComputed for filteredItems

* dbeaver/pro#6283 style: update z-index for  ComboboxPopover component

our backdrop component has 999 z-index(weird?), we need more to show popover in modals

* dbeaver/pro#6283 feat: put CB Combobox near the component, fix layers issue

* dbeaver/pro#6283 fix: radio title wrap

* dbeaver/pro#6283 fix: use the same letter spacing as in other inputs

* dbeaver/pro#6283 fix:combobox item styles

* dbeaver/pro#6283 fix: clear value on click

this fix is for situation when user started to type a word, found an option and clicked on it. Previously we didn't clear value and just setSelectedValue on click. This fix clears value as it happens onBlur and we use the value from selectedItem.

---------

Co-authored-by: mr-anton-t <42037741+mr-anton-t@users.noreply.github.com>
2025-08-11 23:07:28 +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>