按钮裁剪
@cloud-ru/ds-uikit-product-button-predefined - 函数 - \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\.
Кнопка view='function' с AdaptiveDroplist时间轴: 桌面 —— 说 Droplist из @cloud-ru/ds-list时 移动 —— 说 @cloud-ru/ds-modal со. {\fn黑体\fs22\bord1\shad0\3aHBE\4aH00\fscx67\fscy66\2cHFFFFFF\3cH808080}你觉得呢 AdaptiveProvider (см. @cloud-ru/ds-adaptive(原始内容存档于2018-10-25). ). {\fn黑体\fs22\bord1\shad0\3aHBE\4aH00\fscx67\fscy66\2cHFFFFFF\3cH808080}你觉得呢 PriceSummary {\fn黑体\fs22\bord1\shad0\3ahbe\4ah00\fscx67\fscy66\2chffffff\3ch808080}你觉得呢.
Когда
- {\fn黑体\fs22\bord1\shad0\3aHBE\4aH00\fscx67\fscy66\2cHFFFFFF\3cH808080}你觉得呢.
- 台式电脑 台式电脑 台式电脑.
Когда не нужен ButtonDropdown数字 :
- {\fn黑体\fs22\bord1\shad0\3aHBE\4aH00\fscx67\fscy66\2cHFFFFFF\3cH808080}=========================================================== -===========================================================================================================================================================================
Dropdown。 。 。 . - {\fn黑体\fs22\bord1\shad0\3aHBE\4aH00\fscx67\fscy66\2cHFFFFFF\3cH808080}你觉得呢
Buttonview='function'。 。 。 .
Анатомия
触发
Button view='function' appearance='neutral' 页:1 buttonFunctionNeutral \ \ \ \ \ label {\fn黑体\fs22\bord1\shad0\3aHBE\4aH00\fscx67\fscy66\2cHFFFFFF\3cH808080}上下两地 При open={true} {\fn黑体\fs22\bord1\shad0\3ahbe\4ah00\fscx67\fscy66\2chffffff\3ch808080}你觉得呢 data-pressed - \ \ \ \ \ \ \ \ stateLayer/text/opacity (прозрачность标签/相) @cloud-ru/ds-materials) (中文(简体) ).
丢弃列表
ButtonDropdown рендерит Droplist из @cloud-ru/ds-list . . . . . AdaptiveProvider说吧
- 桌面 {\fn黑体\fs22\bord1\shad0\3ahbe\4ah00\fscx67\fscy66\2chffffff\3ch808080}你觉得怎么样.
- 移动 - список уходит уходит в в
@cloud-ru/ds-list) (中文(简体) ).
项目
Массив Droplist (单位:千美元)content.label, (中文(简体) ), onClick, (中文(简体) ), id) (中文(简体) ). При closeDroplistOnItemClick {\fn黑体\fs22\bord1\shad0\3ahbe\4ah00\fscx67\fscy66\2chffffff\3ch808080}你觉得呢.
大小( 默认) s(中文(简体) )
xs- \ \ \ \ \ \ \ \ \ \ \s(алиас.s——компактный.m——средний.l——крупный.
外观( 默认) neutral(中文(简体) )
~ ~ ~ ~ ~ ~ ~ Button view='function'数字 :
neutral——нейтральный,основной.primary- 额...critical——критическое.
打开/ 在打开更改上
控制 API QQ useValueControl (как @cloud-ru/ds-utils) (中文(简体) ).
Установка
pnpm add @cloud-ru/ds-uikit-product-button-predefined
import { ButtonDropdown } from '@cloud-ru/ds-uikit-product-button-predefined'
Базовый
<ButtonDropdown
label='Period'
size='s'
closeDroplistOnItemClick
items={[
{ id: 'month', content: { label: 'Month' }, onClick: () => setPeriod('month') },
{ id: 'year', content: { label: 'Year' }, onClick: () => setPeriod('year') },
]}
/>
Примеры
{/* 客户端:只 — Droplist {} {} { { { { {}} { { { { { { { { }} { { } { { { }}} { { { { { { } { { }} { }} { } { { } } { { } { { { } } } { { { { } } { { } { } { } { } { } { { } { { } { { { } } { } { { } { } { } { } { } { } / { } { } { } { } { { { } { { }
桌面基础
{\fn黑体\fs22\bord1\shad0\3aHBE\4aH00\fscx67\fscy66\2cHFFFFFF\3cH808080}你觉得呢.
import { AdaptiveProvider, LAYOUT_TYPE } from '@cloud-ru/ds-adaptive';
import { ButtonDropdown } from '@cloud-ru/ds-uikit-product-button-predefined';
import { useState } from 'react';
const periods = [
{ id: 'month', label: 'Month' },
{ id: 'year', label: 'Year' },
];
export function DesktopBasic() {
const [period, setPeriod] = useState(periods[0]);
const items = periods.map(option => ({
id: option.id,
content: { label: option.label },
onClick: () => setPeriod(option),
}));
return (
<AdaptiveProvider layoutType={LAYOUT_TYPE.Desktop}>
<ButtonDropdown label={period.label} size='s' items={items} closeDroplistOnItemClick />
</AdaptiveProvider>
);
}
桌面打开状态
(原始内容存档于2017-10-21) (中文(简体) ).
import { AdaptiveProvider, LAYOUT_TYPE } from '@cloud-ru/ds-adaptive';
import { ButtonDropdown } from '@cloud-ru/ds-uikit-product-button-predefined';
import { useState } from 'react';
const periods = [
{ id: 'month', label: 'Month' },
{ id: 'year', label: 'Year' },
];
export function DesktopOpen() {
const [period, setPeriod] = useState(periods[0]);
const items = periods.map(option => ({
id: option.id,
content: { label: option.label },
onClick: () => setPeriod(option),
}));
return (
<AdaptiveProvider layoutType={LAYOUT_TYPE.Desktop}>
<ButtonDropdown label={period.label} size='m' open items={items} />
</AdaptiveProvider>
);
}
移动布局
适应性Provider布局 Type=mobile QQ 模式QQ.
import { AdaptiveProvider, LAYOUT_TYPE } from '@cloud-ru/ds-adaptive';
import { ButtonDropdown } from '@cloud-ru/ds-uikit-product-button-predefined';
import { useState } from 'react';
const periods = [
{ id: 'month', label: 'Month' },
{ id: 'year', label: 'Year' },
];
export function MobileLayout() {
const [period, setPeriod] = useState(periods[0]);
const items = periods.map(option => ({
id: option.id,
content: { label: option.label },
onClick: () => setPeriod(option),
}));
return (
<AdaptiveProvider layoutType={LAYOUT_TYPE.Mobile}>
<ButtonDropdown label={period.label} size='s' closeDroplistOnItemClick items={items} />
</AdaptiveProvider>
);
}
道具
按下按钮
| Prop | 类型 | 默认 | 说明 |
|---|---|---|---|
appearance | "critical" | "neutral" | "primary" | neutral | Вариант |
as | "button" | —— 说 | ============================================================================================ (============================================================================ 链接 QQ 反应- router- dom) |
className | string | —— 说 | Дополнительный Класс. |
closeDroplistOnItemClick | boolean | false | {\fn黑体\fs22\bord1\shad0\3aHBE\4aH00\fscx67\fscy66\2cHFFFFFF\3cH808080}你觉得呢. =============================================================================================== (=============================================================================== |
closeOnPopstate | boolean | —— 说 | {\fn黑体\fs22\bord1\shad0\3aHBE\4aH00\fscx67\fscy66\2cHFFFFFF\3cH808080}你觉得呢 |
counter | CounterProps | —— 说 | 计数器. appearance можно(一作相出. |
data-test-id | string | —— 说 | |
disabled | boolean | —— 说 | Отключена |
fullWidth | boolean | —— 说 | {\fn黑体\fs22\bord1\shad0\3aHBE\4aH00\fscx67\fscy66\2cHFFFFFF\3cH808080}你觉得呢 |
innerRef | PolymorphicRef | —— 说 | 参考: реальный DOM-элемент/инстанс,который as。 。 。 . Используем,чтобы也 forwardRef (原始内容存档于2018-09-21) (英语). |
items | BaseItemWithoutNonGroup | CommonGroupItem | Item | ScrollProps | —— 说 | {\fn黑体\fs22\bord1\shad0\3aHBE\4aH00\fscx67\fscy66\2cHFFFFFF\3cH808080}你觉得呢 |
label | string | —— 说 | Текст |
loading | boolean | —— 说 | Состояние |
minWidth | boolean | —— 说 | Минимальная(ширина)min-width (原始内容存档于2018-09-28). QQ. По true。 。 。 . false . . . . . . |
onOpenChange | ((open: boolean) => void) | —— 说 | Колбэк. |
open | boolean | —— 说 | Контролируемое. |
placement | "bottom" | "bottom-end" | "bottom-start" | "left" | "left-end" | "left-start" | "right" | "right-end" | "right-start" | "top" | "top-end" | "top-start" | top | (原始内容存档于2019-09-29) (中文(中国大陆) ). |
size | "l" | "m" | "s" | "xs" | s | Размер; для xs применяется s。 。 。 . |
triggerClassName | string | —— 说 | CSS - класс триггера |
相关类型
ButtonDropdownSize=:"l"|"m"|"s"|"xs"