UNPKG

@yandex/ui

Version:

Yandex UI components

75 lines (58 loc) 30.4 kB
# Spacer <a href='https://github.yandex-team.ru/search-interfaces/frontend/tree/master/packages/lego-components/src/Spacer' target='_blank'><img src='https://badger.yandex-team.ru/custom/[Исходники]/[Github ][green]/badge.svg' /></a> <a href='https://search.yandex-team.ru/stsearch?text=Spacer.ts&facet.queue=ISL&facet.type=bug&facet.status=128' target='_blank'><img src='https://badger.yandex-team.ru/custom/[Известные проблемы]/[Startrek][blue]/badge.svg' /></a> <!-- description:start --> Компонент, который вставляет потомков с заданным смещением. <!-- description:end --> ## Использование компонента Значения внутренних отступов можно задать с помощью трех вариантов. 1. С помощью свойства `all`: ```ts // src/App.ts import React from 'react' import { Spacer } from '@yandex-lego/components/Spacer' const App = () => ( <Spacer all={10}> Content </Spacer> ) ``` 2. С помощью свойства `vertical` и/или `horizontal`: ```ts // src/App.ts import React from 'react' import { Spacer } from '@yandex-lego/components/Spacer' const App = () => ( <Spacer vertical={10} horizontal={20}> Content </Spacer> ) ``` 3. С помощью свойств `top` и/или `bottom` и `right` и/или `left`: ```ts // src/App.ts import React from 'react' import { Spacer } from '@yandex-lego/components/Spacer' const App = () => ( <Spacer top={10}> Content </Spacer> ) ``` > Указать единицы измерения можно, передав значение в виде строки, например `10rem`, по умолчанию будут использованы `px`. ## Свойства <!-- props:start --> | Свойство | Тип | По умолчанию | Описание | | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------------------------------------- | | innerRef? | `RefObject<HTMLElement>` | — | Ссылка на корневой DOM-элемент компонента | | style? | `CSSProperties` | — | Пользовательские стили | | className? | `string` | — | Дополнительный класс | | as? | `"symbol" \| "object" \| "a" \| "abbr" \| "address" \| "area" \| "article" \| "aside" \| "audio" \| "b" \| "base" \| "bdi" \| "bdo" \| "big" \| "blockquote" \| "body" \| "br" \| "button" \| "canvas" \| "caption" \| "cite" \| "code" \| "col" \| "colgroup" \| "data" \| "datalist" \| "dd" \| "del" \| "details" \| "dfn" \| "dialog" \| "div" \| "dl" \| "dt" \| "em" \| "embed" \| "fieldset" \| "figcaption" \| "figure" \| "footer" \| "form" \| "h1" \| "h2" \| "h3" \| "h4" \| "h5" \| "h6" \| "head" \| "header" \| "hgroup" \| "hr" \| "html" \| "i" \| "iframe" \| "img" \| "input" \| "ins" \| "kbd" \| "keygen" \| "label" \| "legend" \| "li" \| "link" \| "main" \| "map" \| "mark" \| "menu" \| "menuitem" \| "meta" \| "meter" \| "nav" \| "noindex" \| "noscript" \| "ol" \| "optgroup" \| "option" \| "output" \| "p" \| "param" \| "picture" \| "pre" \| "progress" \| "q" \| "rp" \| "rt" \| "ruby" \| "s" \| "samp" \| "script" \| "section" \| "select" \| "small" \| "source" \| "span" \| "strong" \| "style" \| "sub" \| "summary" \| "sup" \| "table" \| "tbody" \| "td" \| "textarea" \| "tfoot" \| "th" \| "thead" \| "time" \| "title" \| "tr" \| "track" \| "u" \| "ul" \| "var" \| "video" \| "wbr" \| "webview" \| "svg" \| "animate" \| "animateMotion" \| "animateTransform" \| "circle" \| "clipPath" \| "defs" \| "desc" \| "ellipse" \| "feBlend" \| "feColorMatrix" \| "feComponentTransfer" \| "feComposite" \| "feConvolveMatrix" \| "feDiffuseLighting" \| "feDisplacementMap" \| "feDistantLight" \| "feDropShadow" \| "feFlood" \| "feFuncA" \| "feFuncB" \| "feFuncG" \| "feFuncR" \| "feGaussianBlur" \| "feImage" \| "feMerge" \| "feMergeNode" \| "feMorphology" \| "feOffset" \| "fePointLight" \| "feSpecularLighting" \| "feSpotLight" \| "feTile" \| "feTurbulence" \| "filter" \| "foreignObject" \| "g" \| "image" \| "line" \| "linearGradient" \| "marker" \| "mask" \| "metadata" \| "mpath" \| "path" \| "pattern" \| "polygon" \| "polyline" \| "radialGradient" \| "rect" \| "stop" \| "switch" \| "text" \| "textPath" \| "tspan" \| "use" \| "view" \| ComponentClass<any, any> \| FunctionComponent<any>` | `'div'` | Компонент для рендера | | all? | `string \| number` | — | Описание отсутствует | | vertical? | `string \| number` | — | Описание отсутствует | | horizontal? | `string \| number` | — | Описание отсутствует | | top? | `string \| number` | — | Описание отсутствует | | bottom? | `string \| number` | — | Описание отсутствует | | left? | `string \| number` | — | Описание отсутствует | | right? | `string \| number` | — | Описание отсутствует | <!-- props:end -->