I need to change the style of 4 of my p:selectBooleanCheckBox to style it as radio button.
Asked
Active
Viewed 284 times
-2
-
https://xyproblem.info/ – Jasper de Vries Apr 09 '21 at 08:26
-
@JasperdeVries i mean i think i explain the question, i have a checkbox and i want to show it as the radio button style, checkbox is a square and i need a circle – Abel Juan Rodríguez Apr 09 '21 at 12:48
-
You are doing something wrong conceptually, and / or you are going to confuse your users – Jasper de Vries Apr 09 '21 at 13:33
-
@JasperdeVries has a point. From a user-interaction perspective that's a very bad idea and will confuse the end-user. What a checkbox is and what a radio button is, is standardized since a long time back. – Adam Waldenberg Apr 11 '21 at 11:10
1 Answers
1
In more detail: if you would style check boxes as radio boxes, you will confuse the user, as multiple options can be selected, which is not the case with radio buttons. With radio buttons you can only select one option. So, I suggest to simply switch to radio buttons instead of trying to hack your way out of this.
If you really want to style your checkboxes, have a look at How do I override default PrimeFaces CSS with custom styles? But again, think hard before doing so.
The source of the free themes is open. See for example https://github.com/primefaces/primefaces/blob/master/src/main/resources/META-INF/resources/primefaces-saga/theme.css and search for radiobutton
.

Jasper de Vries
- 19,370
- 6
- 64
- 102