Skip to content

Commit

Permalink
docs(button): disabled with popover
Browse files Browse the repository at this point in the history
  • Loading branch information
07akioni committed Dec 24, 2021
1 parent 928d611 commit 063024a
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 5 deletions.
12 changes: 7 additions & 5 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
semi: false
singleQuote: true
printWidth: 80
trailingComma: "none"
proseWrap: "never"
{
"semi": false,
"singleQuote": true,
"printWidth": 80,
"trailingComma": "none",
"proseWrap": "never"
}
1 change: 1 addition & 0 deletions src/button/demos/enUS/index.demo-entry.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ loading
color
group
icon-button
popover
```

## API
Expand Down
14 changes: 14 additions & 0 deletions src/button/demos/enUS/popover.demo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Using popover in disabled state

The native disabled button won't trigger some mouse events so `n-popover` can't listen to it. If you need to use it, you can use `tag` prop to change button's behavior.

```html
<n-space>
<n-tooltip>
<template #trigger>
<n-button disabled tag="div">Disabled button as div</n-button>
</template>
Lipsum
</n-tooltip>
</n-space>
```
1 change: 1 addition & 0 deletions src/button/demos/zhCN/index.demo-entry.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ loading
color
group
icon-button
popover
rtl-debug
debug
```
Expand Down
21 changes: 21 additions & 0 deletions src/button/demos/zhCN/popover.demo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 配合 Popover 的特殊情况

原生的 disabled 的 button 不会触发鼠标,因此 `n-popover` 无法监听到相关的事件。如果你需要在这种情况下使用,可以使用 `tag` 属性来调整 button 的行为。

```html
<n-space>
<n-tooltip>
<template #trigger>
<n-button disabled tag="div">突破</n-button>
</template>
工作遇到困难,齐心协力一起解决
</n-tooltip>
<n-button>两天加班换一天调休</n-button>
<n-tooltip>
<template #trigger>
<n-button disabled tag="div">惦记</n-button>
</template>
你必然一身才华,才会被这么多人惦记
</n-tooltip>
</n-space>
```

1 comment on commit 063024a

@vercel
Copy link

@vercel vercel bot commented on 063024a Dec 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.