Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/main/src/RadioButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ let activeRadio: RadioButton;
* @public
* @csspart outer-ring - Used to style the outer ring of the `ui5-radio-button`.
* @csspart inner-ring - Used to style the inner ring of the `ui5-radio-button`.
* @csspart ring - Used to style the ring of the `ui5-radio-button`.
* @csspart label - Used to style the label of the `ui5-radio-button`.
* @csspart radio-button-inner - Used to style the inner element of the `ui5-radio-button`.
* @csspart svg - Used to style the svg element of the `ui5-radio-button`.
*/
@customElement({
tag: "ui5-radio-button",
Expand Down
7 changes: 4 additions & 3 deletions packages/main/src/RadioButtonTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Label from "./Label.js";
export default function RadioButtonTemplate(this: RadioButton) {
return (
<div
part="radio-button-inner"
role="radio"
class="ui5-radio-root"
aria-checked={this.checked}
Expand All @@ -19,11 +20,11 @@ export default function RadioButtonTemplate(this: RadioButton) {
onMouseUp={this._onmouseup}
onFocusOut={this._onfocusout}
>
<div class={{
<div part="ring" class={{
"ui5-radio-inner": true,
"ui5-radio-inner--hoverable": !this.disabled && !this.readonly && isDesktop(),
}}>
<svg class="ui5-radio-svg" focusable="false" aria-hidden="true">
<svg part="svg" class="ui5-radio-svg" focusable="false" aria-hidden="true">
<circle part="outer-ring" class="ui5-radio-svg-outer" cx="50%" cy="50%" r="50%" />
<circle part="inner-ring" class="ui5-radio-svg-inner" cx="50%" cy="50%" />
</svg>
Expand All @@ -39,7 +40,7 @@ export default function RadioButtonTemplate(this: RadioButton) {
</div>

{this.text &&
<Label id={`${this._id}-label`} class="ui5-radio-label" for={this._id} wrappingType={this.wrappingType}>{this.text}</Label>
<Label part="label" id={`${this._id}-label`} class="ui5-radio-label" for={this._id} wrappingType={this.wrappingType}>{this.text}</Label>
}

{this.hasValueState &&
Expand Down
2 changes: 2 additions & 0 deletions packages/main/test/pages/RadioButton.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@
<ui5-radio-button id="customRb1" checked text="Inner ring on hover"></ui5-radio-button>
<ui5-radio-button value-state="Negative" text="Outer ring with Negative State"></ui5-radio-button>
<ui5-radio-button value-state="Positive" text="Outer ring with Positive State"></ui5-radio-button>
<ui5-radio-button id="customRb2" checked text="No paddings"></ui5-radio-button>
<ui5-radio-button id="customRb3" checked></ui5-radio-button>
</div>

<script>
Expand Down
21 changes: 20 additions & 1 deletion packages/main/test/pages/styles/RadioButton.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,25 @@ div.customStyling{
.customStyling ui5-radio-button[value-state="Negative"]::part(outer-ring) {
stroke: rgb(212 56 247);
}

.customStyling ui5-radio-button[value-state="Positive"]::part(outer-ring) {
stroke: rgb(12 223 147);
}
}

.customStyling #customRb2::part(ring),
.customStyling #customRb2::part(label),
.customStyling #customRb3::part(ring),
.customStyling #customRb3::part(label) {
padding: 0;
max-height: 22px;
}

.customStyling #customRb2::part(radio-button-inner)::before,
.customStyling #customRb3::part(radio-button-inner)::before {
inset: 0;
}

.customStyling #customRb2::part(svg) {
width: 16px;
height: 16px;
}
Loading