Button
唯一的按钮组件:六种变体、四种文字尺寸和四种方形图标尺寸,另含按钮组。
可用框架
Angular: 可用 Vue: 可用 React: 可用 React Native: 可用
用法
<div class="demo-stack">
<div class="demo-row">
<button soneBtn type="button">Default</button>
<button soneBtn type="button" variant="accent">Accent</button>
<button soneBtn type="button" variant="secondary">Secondary</button>
<button soneBtn type="button" variant="soft">Soft</button>
<button soneBtn type="button" variant="outline">Outline</button>
<button soneBtn type="button" variant="ghost">Ghost</button>
<button soneBtn type="button" variant="destructive">Destructive</button>
<button soneBtn type="button" variant="link">Link</button>
</div>
<div class="demo-row">
<button soneBtn type="button" size="xs">Extra small</button>
<button soneBtn type="button" size="sm">Small</button>
<button soneBtn type="button">Default</button>
<button soneBtn type="button" size="lg">Large</button>
<button soneBtn type="button" disabled>Disabled</button>
</div>
<div class="demo-row" style="align-items: center">
<button soneBtn type="button" variant="ghost" size="icon" aria-label="Share"><sone-icon icon="share" /></button>
<button soneBtn type="button" variant="soft" size="icon" aria-label="Settings"><sone-icon icon="settings" /></button>
<button soneBtn type="button" variant="outline" size="icon" aria-label="Copy"><sone-icon icon="copy" /></button>
<!-- Toggle buttons: aria-pressed="true" draws the pressed fill -->
<button soneBtn type="button" variant="ghost" size="icon" aria-label="Star"
[attr.aria-pressed]="starred()" (click)="starred.set(!starred())"><sone-icon icon="star" /></button>
<button soneBtn type="button" variant="outline" size="icon" aria-label="Pin to sidebar"
[attr.aria-pressed]="pinned()" (click)="pinned.set(!pinned())"><sone-icon icon="bookmark" /></button>
</div>
<div soneButtonGroup>
<button soneBtn type="button" variant="outline">Day</button>
<button soneBtn type="button" variant="outline">Week</button>
<button soneBtn type="button" variant="outline">Month</button>
</div>
</div>导入
import {
SoneButtonDirective,
SoneButtonGroupDirective,
} from "@surface-one/angular/button";API 参考
SoneButtonDirective指令
| 名称 | 类型 | 默认值 |
|---|---|---|
variant`accent`: filled with the accent (the primary call to action where `default` is ink). `soft`: a translucent grey fill (a quiet icon button). A toggle button with `aria-pressed="true"` gets the pressed fill in `ghost`, `outline` (keeping its border) and `soft`. | ButtonVariant | "default" |
size | ButtonSize | "default" |
SoneButtonGroupDirective指令
| 名称 | 类型 | 默认值 |
|---|---|---|
orientation | "horizontal" | "vertical" | "horizontal" |