Previews

No matching results.

x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<div data-view-component="true" class="ButtonGroup">
<div>
<button id="button-1" type="button" data-view-component="true" class="Button--secondary Button--medium Button"> <span class="Button-content">
<span class="Button-label">Button 1</span>
</span>
</button><tool-tip id="tooltip-3a1814d9-c5d8-4611-b22a-aeab88386564" for="button-1" popover="manual" data-direction="s" data-type="description" data-view-component="true" class="sr-only position-absolute">Button Tooltip</tool-tip>
</div>
<div>
<a id="button-2" href="#" data-view-component="true" class="Button--secondary Button--medium Button"> <span class="Button-content">
<span class="Button-label">Button 2</span>
</span>
</a><tool-tip id="tooltip-d2081c97-d738-4e26-b977-8d9b97fad3d8" for="button-2" popover="manual" data-direction="s" data-type="description" data-view-component="true" class="sr-only position-absolute">Button Tooltip</tool-tip>
</div>
</div>
1
2
3
4
5
6
7
8
9
10
render(Primer::Beta::ButtonGroup.new) do |component|
component.with_button(id: "button-1", tag: :button) do |button|
button.with_tooltip(text: "Button Tooltip")
"Button 1"
end
component.with_button(id: "button-2", tag: :a, href: "#") do |button|
button.with_tooltip(text: "Button Tooltip")
"Button 2"
end
end

app/components/primer/beta/button_group.css

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
.ButtonGroup {
display: inline-flex;
}
.ButtonGroup .Button {
margin-inline-end: -1px;
position: relative;
border-radius: 0;
}
.ButtonGroup .Button:focus,
.ButtonGroup .Button:active,
.ButtonGroup .Button:hover {
z-index: 1;
}
.ButtonGroup > :first-child .Button {
border-top-left-radius: var(--borderRadius-medium);
border-bottom-left-radius: var(--borderRadius-medium);
}
.ButtonGroup > :last-child .Button {
border-top-right-radius: var(--borderRadius-medium);
border-bottom-right-radius: var(--borderRadius-medium);
}