You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Show [specs](../../spec/usage/components/button_spec.rb)
4
+
5
+
The HTML `<button>` tag implemented in Ruby.
6
+
7
+
## Parameters
8
+
9
+
This component can take 4 optional configuration params and optional content.
10
+
11
+
#### # id (optional)
12
+
Expects a string with all ids the button should have.
13
+
14
+
#### # class (optional)
15
+
Expects a string with all classes the button should have.
16
+
17
+
#### # text (optional)
18
+
Expects a string with the text that should go inside the `<button>` tag.
19
+
20
+
#### # disabled (optional)
21
+
Expects a boolean to specify a disabled `<button>` tag.
22
+
23
+
## Example 1
24
+
25
+
Specifying the button text directly
26
+
27
+
```ruby
28
+
button text:'Click me'
29
+
```
30
+
31
+
returns
32
+
33
+
```html
34
+
<button>Click me</button>
35
+
```
36
+
37
+
## Example 2
38
+
39
+
Rendering a content block inside the `<button>` tag:
40
+
41
+
```ruby
42
+
button id:'foo', class: 'bar'do
43
+
plain "Click me"
44
+
end
45
+
```
46
+
47
+
returns
48
+
49
+
```html
50
+
<buttonid="foo"class="bar">Click me</button>
51
+
```
52
+
53
+
## Example 3
54
+
55
+
By passing a boolean via `disabled: true`, you define disabled buttons. Passing nothing or explicitly defining `disabled: false` return the same result:
56
+
57
+
```ruby
58
+
button disabled:true, text:'You can not click me'
59
+
button disabled:false, text:'You can click me'
60
+
button text:'You can click me too'
61
+
```
62
+
63
+
returns
64
+
65
+
```html
66
+
<buttondisabled="disabled">You can not click me</button>
0 commit comments