project_note
Clone
https://git.tahinli.com/Tahinli/project_note.git
0 watching0 forksRust3.6 MiBc49f5e7Tahinli1 month ago2 commits
| 1 | use |
| 2 | |
| 3 | |
| 4 | ; |
| 5 | |
| 6 | /// The visual style of a [`button`]. |
| 7 | /// |
| 8 | /// [`Default`] is `ButtonVariant::Primary`, used when no variant is given. |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | /// The size of a [`button`]. |
| 56 | /// |
| 57 | /// [`Default`] is `ButtonSize::Md`, used when no size is given. |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | /// Classes shared by button variants and sizes. A border reserves the same space in |
| 85 | /// every variant. Focus uses the global `:focus-visible` outline from `styles.css`. |
| 86 | const BASE: StaticClass = class! |
| 87 | |
| 88 | |
| 89 | |
| 90 | ; |
| 91 | |
| 92 | /// Builds the full class list for a button of the given `variant` and `size`. |
| 93 | /// |
| 94 | /// Use it to give button styling to an element that is not a `<button>`, such |
| 95 | /// as a link styled as a button: |
| 96 | /// |
| 97 | /// ```ignore |
| 98 | /// view! { |
| 99 | /// <a href="/login" class=(button_variants(ButtonVariant::Outline, ButtonSize::Md))> |
| 100 | /// "Sign in" |
| 101 | /// </a> |
| 102 | /// } |
| 103 | /// ``` |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | /// A styled button. |
| 113 | /// |
| 114 | /// `variant` defaults to `Primary` and `size` to `Md`. Pass the content as children. |
| 115 | /// `keycap` shows a keyboard shortcut inside the button after the label, for example |
| 116 | /// `kbd("Ctrl") kbd("K")`. `attrs` are forwarded to the `<button>`, with extra classes |
| 117 | /// added to its classes. Use [`button_variants`] to apply the same styling to another |
| 118 | /// element. |
| 119 | /// |
| 120 | /// A disabled button stays visible and greyed out. Pass the reason in `title` or |
| 121 | /// `aria-describedby`. |
| 122 | /// |
| 123 | /// ```ignore |
| 124 | /// view! { |
| 125 | /// button( |
| 126 | /// variant: ButtonVariant::Destructive, |
| 127 | /// attrs: attributes! { type="submit" }, |
| 128 | /// "Delete" |
| 129 | /// ) |
| 130 | /// } |
| 131 | /// ``` |
| 132 | |
| 133 | pub async |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 |