Monorepo of React component libraries for Lido Finance projects.
This repository is a Yarn workspaces monorepo orchestrated with Turborepo. It publishes the following packages to npm:
| Package | npm name | Description | Storybook |
|---|---|---|---|
packages/lido-landing-ui |
@lidofinance/lido-landing-ui |
Components tailored for Lido's landing / marketing pages (banners, cards, tags, tooltips, typography, etc). One of the two current replacements for lido-ui. |
ui.lido.fi/lido-landing-ui |
packages/lido-app-ui |
@lidofinance/lido-app-ui |
Components for Lido app/widget products. Currently small and growing. The other current replacement for lido-ui. |
ui.lido.fi/lido-app-ui |
packages/lido-shared-ui |
@lidofinance/lido-shared-ui |
Shared hooks, utils, theme CSS and types consumed by the other packages. No Storybook of its own. | — |
packages/lido-ui |
@lidofinance/lido-ui |
Deprecated / legacy. The original component library (buttons, inputs, modals, data tables, icons, theme, etc). Being phased out in favor of lido-landing-ui / lido-app-ui. Avoid adding new components here. |
ui.lido.fi |
Note:
@lidofinance/lido-uiis deprecated and no longer the primary library. It is being slowly replaced by@lidofinance/lido-landing-uior@lidofinance/lido-app-ui, depending on the design requirements of the consuming project — pick whichever matches the target project's design system for new work.
Published Storybooks are deployed to GitHub Pages by deploy-storybook.yml: lido-ui is published at the domain root (ui.lido.fi), while lido-landing-ui and lido-app-ui are published under their own subfolders.
lido-shared-uihas no internal dependencies — it's the shared foundation (hooks, utils, theme-css, types).lido-landing-uiandlido-app-uidepend onlido-shared-ui.lido-uicurrently has no internal dependencies and is self-contained (legacy, not built on the shared foundation).
Each package under packages/* follows the same shape:
src/- component source codedist/- build output (cjsandesm), generated onbuild, not committedrollup.config.mjs- Rollup build configtsconfig.json/tsconfig.production.json- TypeScript configs (production config is used for.d.tsgeneration during build)vitest.config.ts- test config
Turborepo (configured in turbo.json) runs tasks across all packages and caches results:
yarn build→turbo run build- builds every package; a package'sbuilddepends on^build(its dependencies' builds), solido-shared-uiis always built beforelido-landing-ui/lido-app-ui.yarn test→turbo run testyarn lint→turbo run lintyarn types→turbo run typesyarn build-storybook→turbo run build-storybook
- Install the required node version
nvm use
- To get started, install the dependencies:
yarn install
- Build the packages:
yarn build
Run a package's Storybook directly:
yarn storybook:ui- Storybook forlido-ui(port5555)yarn storybook:landing- Storybook forlido-landing-ui(port5556)yarn storybook:widget- Storybook forlido-app-ui(port5557)
Or target any workspace script directly with yarn workspace <package-name> <script>, e.g.:
yarn workspace @lidofinance/lido-ui test
yarn workspace @lidofinance/lido-landing-ui icons:convertRepo-wide scripts:
yarn build- Build all packages.yarn test- Run tests across packages.yarn lint- Run eslint across packages.
Packages are automatically published to npm when you push to master. The publication is based on semantic-release and @lidofinance/multi-semantic-release.
All packages are versioned and published together — multi-semantic-release understands the internal dependency graph above (e.g. a breaking change in lido-shared-ui bumps the packages depending on it too). See RELEASES.md for the full release process.
For correct version detection, please follow the conventional commit format. To release a new major version, create a commit with ! like this - feat!: ui v4
- Simply add a library to your dependencies:
yarn add @lidofinance/lido-landing-ui # or @lidofinance/lido-app-ui- Import Lido theme provider and wrap your components in
_app.js:
import { ThemeProvider } from '@lidofinance/lido-app-ui'
function App({ Component }) {
return (
<ThemeProvider>
<Component />
</ThemeProvider>
)
}- Import styles into your
_app.jsfile:
import '@lidofinance/lido-app-ui/index.css';-
CSS variables are initially embedded in the
index.cssfile. To use typography styles across your application, you have two options:-
Include the CSS file:
If you want to use ready-made classes with styles, you need to import an additional CSS file.
Insert the following line at the top of your_app.jsfile to import the typography styles:import '@lidofinance/lido-app-ui/styles/typography.css';
-
Use PostCSS mixins:
If you prefer to use PostCSS mixins for typography, you need to configure PostCSS in your project. Add thepostcss-mixinsplugin to your PostCSS configuration and include the typography mixins provided by the library.
Examplepostcss.config.jsconfiguration:module.exports = { plugins: [ ... [ "postcss-mixins", { mixinsDir: path.resolve('./node_modules/@lidofinance/lido-app-ui/dist/styles'), }, ], ], };
Once configured, you can use the typography mixins directly in your CSS files. For example:
@mixin font-h2;
-
Then simply import any components and use in your project:
import { Button } from '@lidofinance/lido-app-ui'Lido UI provides a comprehensive set of CSS variables that can be overridden to match your application's design system. This allows you to maintain the functionality of Lido UI components while adapting their appearance to your brand.
To customize the CSS variables, create a CSS file in your project with new definitions:
:root {
/* Override typography */
--lido-ui-font-family: "Your-Custom-Font", sans-serif;
--lido-ui-font-size-body: 16px;
--lido-ui-line-height-body: 24px;
/* Override colors */
--lido-ui-color-text-primary: #your-primary-color;
}Import this file after the Lido UI styles in your application:
import '@lidofinance/lido-app-ui/index.css';
import './your-custom-variables.css'; // Import your overrides after Lido UI stylesLido UI provides several categories of CSS variables that can be customized:
-
Typography
- Font family:
--lido-ui-font-family - Font sizes:
--lido-ui-font-size-*(h1, h2, h3, h4, subheader, control, body, description) - Font weights:
--lido-ui-font-weight-*(bold, medium, regular, light, extra-light) - Line heights:
--lido-ui-line-height-*(h1, h2, h3, h4, subheader, control, body, description)
- Font family:
-
Colors
- Theme colors:
--lido-ui-color-*(background, foreground, primary, text, etc.)
- Theme colors:
-
Border Radiuses
--lido-ui-border-radius-*(4, 40, 50, 60, 70)
-
Theme-Specific Variables
- Light/dark mode visibility:
--lido-ui-light-mode-visibility,--lido-ui-dark-mode-visibility - Display properties:
--lido-ui-light-display,--lido-ui-dark-display
- Light/dark mode visibility:
Some variables like font sizes and line heights have responsive variants defined in media queries. You can also override these for specific breakpoints:
@media (--lido-ui-breakpoint-md-down) {
:root {
--lido-ui-font-size-h1: 48px;
--lido-ui-line-height-h1: 52px;
}
}By default, the theme will be set to the value obtained after calling the themeScriptValueString method and will be the same as all other Lido products. This ensures consistent theming across the Lido ecosystem.
- For products with theme switching: You must use
CookieThemeProviderandThemeTogglercomponents - For products without theme switching: You must use
ThemeProviderwith your chosen theme. OrCookieThemeProviderwith hardcodedoverrideThemeNameandinitialThemeName
The CookieThemeProvider determines the theme based on the following priority:
- Override theme (if provided)
- URL query parameter
- Cookie value
- Initial theme (if provided)
- System preference (light/dark mode)
- Default theme
-
Add the SVG file to one of the category folders in
packages/icons/svg/:base/- Basic UI icons (arrows, close, info, etc.)defi/- DeFi-related icons (protocols, networks, wallets)general/- General purpose icons (social media, docs, etc.)lido/- Lido-specific icons (projects, teams)logo/- Brand logosstrategies/- Strategy-related iconstoken/- Token/cryptocurrency icons
-
Commit changes. The conversion will run automatically and the result will be added to the current commit
Or - run the conversion script manually - yarn icons:convert
Note: Icon names are automatically converted to PascalCase. Icons in different categories get specific suffixes:
logo/→IconNameLogodefi/networks/arbitrum→Arbitrum.tsx