Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui5-radio-button): expose new Css shadow parts #8347

Merged
merged 2 commits into from
Feb 26, 2024
Merged
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: 2 additions & 2 deletions packages/main/src/RadioButton.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
>
<div class='ui5-radio-inner {{classes.inner}}'>
<svg class="ui5-radio-svg" focusable="false" aria-hidden="true">
<circle class="ui5-radio-svg-outer" cx="50%" cy="50%" r="50%" />
<circle class="ui5-radio-svg-inner" cx="50%" cy="50%" />
<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>
<input type='radio' ?required="{{required}}" ?checked="{{checked}}" ?readonly="{{readonly}}" ?disabled="{{effectiveAriaDisabled}}" name="{{name}}" data-sap-no-tab-ref/>
</div>
Expand Down
2 changes: 2 additions & 0 deletions packages/main/src/RadioButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ let activeRadio: RadioButton;
* @constructor
* @extends UI5Element
* @public
* @csspart outer-ring - Used to style the outer ring of the <code>ui5-radio-button</code>.
* @csspart inner-ring - Used to style the inner ring of the <code>ui5-radio-button</code>.
*/
@customElement({
tag: "ui5-radio-button",
Expand Down
7 changes: 7 additions & 0 deletions packages/main/test/pages/RadioButton.html
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@
<input type="submit">
</form>

<ui5-title level="H2">Custom styling with css parts</ui5-title>
<div class="customStyling">
<ui5-radio-button id="customRb1" checked text="Inner ring on hover"></ui5-radio-button>
<ui5-radio-button value-state="Error" text="Outer ring with Error State"></ui5-radio-button>
<ui5-radio-button value-state="Success" text="Outer ring with Success State"></ui5-radio-button>
</div>

<script>
var counter = 0;
var groupEventCounter = 0;
Expand Down
15 changes: 15 additions & 0 deletions packages/main/test/pages/styles/RadioButton.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,18 @@ div {
.radiobutton2auto {
width: 300px
}

div.customStyling{
width: 100%;
}

.customStyling #customRb1:hover::part(inner-ring) {
fill: #20b7d5;
}

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