|
| 1 | +# `tag` |
| 2 | + |
| 3 | +Used for marking and selection |
| 4 | + |
| 5 | +## Example |
| 6 | + |
| 7 | +### Basic usage |
| 8 | + |
| 9 | +```html |
| 10 | +<tag text="'tag 1'"></tag> |
| 11 | +<tag text="'hello'" color="#ff0000" theme="Error"></tag> |
| 12 | +``` |
| 13 | + |
| 14 | +### Closeable |
| 15 | + |
| 16 | +```html |
| 17 | +<tag text="'hello'" closeable></tag> |
| 18 | +``` |
| 19 | + |
| 20 | +## Attributes |
| 21 | + |
| 22 | +| Name | Description | Type | |
| 23 | +| -------------------- | --------------------------------- | ---------------- | |
| 24 | +| `theme` | Themes | `Themes` | |
| 25 | +| `background_color` | Background color | `MakepadColor` | |
| 26 | +| `background_visible` | Whether to display the background | `bool` | |
| 27 | +| `hover_color` | Hover color | `MakepadColor` | |
| 28 | +| `stroke_hover_color` | Border hover color | `MakepadColor` | |
| 29 | +| `text_hover_color` | Text hover color | `MakepadColor` | |
| 30 | +| `focus_color` | Focus color | `MakepadColor` | |
| 31 | +| `stroke_focus_color` | Border focus color | `MakepadColor` | |
| 32 | +| `text_focus_color` | Text focus color | `MakepadColor` | |
| 33 | +| `border_color` | Border color | `MakepadColor` | |
| 34 | +| `border_width` | Border width | `F32` | |
| 35 | +| `border_radius` | Border radius | `F32` | |
| 36 | +| `shadow_color` | Shadow color | `MakepadColor` | |
| 37 | +| `spread_radius` | Shadow spread radius | `F32` | |
| 38 | +| `blur_radius` | Shadow blur radius | `F32` | |
| 39 | +| `shadow_offset` | Shadow offset | `Vec2` | |
| 40 | +| `text` | Text content | `String` | |
| 41 | +| `font_size` | Font size | `F64` | |
| 42 | +| `color` | Font color | `MakepadColor` | |
| 43 | +| `font_family` | Font family | `LiveDependency` | |
| 44 | +| `height_factor` | Height factor | `F64` | |
| 45 | +| `line_scale` | Line spacing ratio | `F64` | |
| 46 | +| `cursor` | Mouse pointer | `MouseCursor` | |
| 47 | +| `closeable` | Closeable | `bool` | |
| 48 | +| `src` | Resource path | `LiveDependency` | |
| 49 | +| `icon_brightness` | Icon brightness | `F32` | |
| 50 | +| `icon_curve` | Icon curve | `F32` | |
| 51 | +| `icon_linearize` | Icon linearization | `F32` | |
| 52 | +| `icon_scale` | Icon scaling | `F64` | |
| 53 | +| `icon_color` | Icon color | `MakepadColor` | |
| 54 | +| `icon_draw_depth` | Icon drawing depth | `F32` | |
| 55 | +| `visible` | Visible or not | `bool` | |
| 56 | +| `text_walk` | Text layout parameters | `TextWalk` | |
| 57 | +| `grab_key_focus` | Whether to get keyboard focus | `bool` | |
| 58 | +| `icon_walk` | Icon layout parameters | `Walk` | |
| 59 | +| `icon_layout | Icon layout | `Layout` | |
| 60 | +| `abs_pos` | Absolute position | `DVec2` | |
| 61 | +| `margin` | Margin | `Margin` | |
| 62 | +| `width` | Width | `Size` | |
| 63 | +| `height` | Height | `Size` | |
| 64 | +| `scroll` | Scroll offset | `DVec2` | |
| 65 | +| `clip_x` | whether to clip X | `bool` | |
| 66 | +| `clip_y` | whether to clip Y | `bool` | |
| 67 | +| `padding` | inner margin | `Padding` | |
| 68 | +| `align` | alignment | `Align` | |
| 69 | +| `flow` | flow | `Flow` | |
| 70 | +| `spacing` | spacing | `F64` | |
| 71 | +| `animation_key` | whether to enable animation | `bool` | |
| 72 | +| `event_key` | event identifier | `bool` | |
| 73 | + |
| 74 | +## event callback |
| 75 | + |
| 76 | +| name | description | parameter | |
| 77 | +| ------------ | ------------ | -------------------- | |
| 78 | +| `clicked` | click event | `GTagClickedParam` | |
| 79 | +| `hover_in` | hover in | `GTagHoverParam` | |
| 80 | +| `hover_out` | hover out | `GTagHoverParam` | |
| 81 | +| `closed` | closed event | `GTagClosedParam` | |
| 82 | +| `focus` | get focus | `GTagFocusParam` | |
| 83 | +| `focus_lost` | lose focus | `GTagFocusLostParam` | |
0 commit comments