Skip to content

Commit 071b9e5

Browse files
committed
docs(components): add Surface component documentation
1 parent 1ec241c commit 071b9e5

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

docs/en/components/surface.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: surface component
3+
order: 1
4+
---
5+
6+
# Surface
7+
8+
```rust
9+
pub fn surface(
10+
args: SurfaceArgs,
11+
ripple_state: Option<Arc<RippleState>>,
12+
child: impl FnOnce(),
13+
)
14+
```
15+
16+
The `surface` component, as the name suggests, is a surface component, commonly used as a background or container for other components. It can set background color, border, shadow and other properties, and supports click interactions and ripple animations. It is the foundation for many interactive components.
17+
18+
## Arguments
19+
20+
- `args: SurfaceArgs`
21+
22+
This argument configures the style and behavior of the `surface` component, including background color, border, shadow, corner radius, etc. Use `SurfaceArgsBuilder` to build this argument.
23+
24+
- `ripple_state: Option<Arc<RippleState>>`
25+
26+
The state used for the click ripple animation. Passing `None` disables the ripple animation.
27+
28+
- `child: impl FnOnce()`
29+
30+
The child component of `surface`, can be any `#[tessera]` function.

docs/zhHans/components/surface.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: surface 组件
3+
order: 1
4+
---
5+
6+
# Surface
7+
8+
```rust
9+
pub fn surface(
10+
args: SurfaceArgs,
11+
ripple_state: Option<Arc<RippleState>>,
12+
child: impl FnOnce(),
13+
)
14+
```
15+
16+
`surface` 组件,顾名思义,是一个平面组件,通常用作其他组件的背景或者容器使用。它可以设置背景颜色、边框、阴影等属性,同时具有点击交互,水波动画等高级效果,是很多交互组件的基础。
17+
18+
## 参数
19+
20+
- `args: SurfaceArgs`
21+
22+
此参数用于配置`surface`组件的样式和行为,包括背景颜色、边框、阴影、圆角等属性。可以通过`SurfaceArgsBuilder`来构建这个参数。
23+
24+
- `ripple_state: Option<Arc<RippleState>>`
25+
26+
此参数为点击水波纹动画的状态,如果传入`None`,则表示不启用水波纹动画。
27+
28+
- `child: impl FnOnce()`
29+
30+
此参数为`surface`组件的子组件,可以是任何`#[tessera]`函数。

0 commit comments

Comments
 (0)