Code Monkey home page Code Monkey logo

uikit's Introduction

UIKit · npm package CI storybook

A set of flexible, highly practical, and efficient React components for creating rich web applications.

Cover image

Resources

Install

npm install --save-dev @gravity-ui/uikit

Usage

import React from 'react';
import {Button} from '@gravity-ui/uikit';

const SubmitButton = <Button view="action" size="l" />;

Styles

UIKit comes with base styling and theme. In order to everything look nice include this at the top of your entry file:

// index.js

import '@gravity-ui/uikit/styles/fonts.css';
import '@gravity-ui/uikit/styles/styles.css';

// ...

UIKit supports different themes: light, dark and their contrast variants. The theme must be applied. To do that either wrap your app in ThemeProvider:

import {createRoot} from 'react-dom/client';
import {ThemeProvider} from '@gravity-ui/uikit';

const root = createRoot(document.getElementById('root'));
root.render(
  <ThemeProvider theme="light">
    <App />
  </ThemeProvider>,
);

or add specific CSS-classes to the root node:

<!-- index.html -->
<html>
  <body>
    <div id="root" class="g-root g-root_theme_light"></div>
  </body>
</html>

it is possible to generate initial CSS-classes during SSR:

import {getInitialRootClassName} from '@gravity-ui/uikit';

const theme = 'light';
const rootClassName = getInitialRootClassName({theme});
// index.js
import {createRoot} from 'react-dom/client';

const root = createRoot(document.getElementById('root'));
root.render(<App />);

Also, there is a SCSS mixins file with useful helpers to use in your app.

I18N

Some components contain text tokens (words and phrases). They come in two languages: en (default) and ru. To set the language use configure function:

// index.js

import {configure} from '@gravity-ui/uikit';

configure({
  lang: 'ru',
});

Development

To start the development server with storybook run the following:

npm start

uikit's People

Contributors

amje avatar arturabdullin avatar dakenviy avatar darkgenius avatar denisvershkov avatar flunt1k avatar germanvor avatar gravity-ui-bot avatar helenjer avatar imechoim avatar isaevalexandr avatar kirilldyachkovskiy avatar kkirik avatar korvin89 avatar kseniya57 avatar kyzyl-ool avatar lakevostok avatar marginy605 avatar mfyodorov avatar mishnya avatar mournfulcoroner avatar nikitacg avatar niktverd avatar ogonkov avatar raubzeug avatar resure avatar teleginzhenya avatar valeras avatar vvtimofeev avatar yc-ui-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uikit's Issues

Demos and examples

Hi, thank you for your awesome library.

I wondered if you could make more examples and a demo, maybe in form of GitHub pages. I think it s pretty important for a UI library to have a showcase.

Menu item does nothing with qa prop

In the code MenuItemProps inherits from QAProps but when I pass the value^ nothing is changed in the output html. Seems line qa prop is not handled in the component

Modal color update

All the floating items now have the same color --yc-color-base-float but in fact we have two classes of float items — modals and popups. Modals are the ones displayed on top of a veil thet mutes the page. And popups are the ones with a shadow like lists in selects, suggests etc.

In dark mode all the backgrounds are dark and in some modals we display popups and the shadow doesn't work well to separate these items.

So, let's have another semantic variable for the modals — all the floating components with a veil.

  1. Let's create a new semantic variable --yc-color-base-modal
  • light theme: --yc-color-private-white-1000
  • dark theme: --yc-color-private-black-rock-850
  1. Let's assign this variable as a background for the modal

  2. Let's change the veil color --yc-color-sfx-veil in dark theme to optimize modal readability

  • add new private variable --yc-color-private-black-600 with value rgba(0, 0, 0, .6)
  • assign this variable as a value in dark theme

Empty space on tooltip with links

image

When I create a tooltip with no text and with links, there is this weird entry space above the link. Is there a way to remove it ? Or should it be fixed

Disabled popover cursor is pointer

Hi, thank you for your awesome library.

I was working with Popover component and discovered that even if I disable it the cursor stays as pointer. Is this a desired behaviour.

Here is a link to you storybook with Popover disabled.

Translate to English

  • Breadcrumbs #232
  • Button
  • Card #32
  • Checkbox #233
  • ClipboardButton #233
  • ClipboardIcon no README
  • CopyToClipboard #233
  • DropdownMenu #244
  • Icon no README
  • Label #233
  • Link no README
  • List
  • Menu no README
  • Modal no README
  • Popover #233
  • Portal no README
  • Progress #42
  • Radio #233
  • RadioButton #233
  • RadioGroup
  • Skeleton #233
  • Spin #233
  • Switch #233
  • Table
  • Tabs
  • TextInput - storybook still untranslated
  • User #233
  • UserAvatar #244

Weird ArrowToggle rotation

By default it follows CSS transition rules: angle is increasing - move clockwise, angle is decreasing - move counterclockwise. We should able to control this.

Typography update

  • Adding new size Display 4, size 48/52px
  • Renaming Title to Header 2, size 24/28px
  • Renaming Header to Header 1, size 20/24px
  • Adding Subheader 3 - 500, size 17/24px
  • Adding Subheader 2 - 500, size 15/20px
  • Adding Subheader 1 - 500, size 13/18px
  • Renaming Body to Body 1 and it's line-height to 18px
  • Adding Сaption 1 - regular weight, size 11/16px
  • Adding Body 1 Short - regular weight, size 13/16px

We should also try to add fallbacks from medium to bold weight in case when current font doen't have medium weight. For example, medium variant of Arial or Helvetica on macOS should fallback to bold.

Return `outline` for keyboard interactions

outline is disabled for many components in uikit (like <Button/>). This cause major issue for using library with keyboard.

I suggest that it should be changed to using :focus-visible instead. This change will disable outline only for mouse pointer and preserve it for keyboard users.

I can provide PR for this change.

Storybook CI

The idea is to attach link to local storybook on every PR. Storybooks may use same domain, but different path. After PR merge storybook become no longer available.

RadioButton does not call onFocus and onBlur

It seems like the RadioButton component does not call the onFocus and onBlur callbacks. This sometimes prevents the error messages in forms to be shown.

Maybe we could make so those method would be called like on a native radio/checkbox

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.