Primefaces SelectOneButton : Change individual button styles

jsf, jsf-2, primefaces

Solution

There is no "standard" way to do this. The common workaround is to have multiple elements - `SelectItem` in your case - that are styled differently - and use an expression with the `rendered` attribute to determine which ones are visible. This works for any component library, not only primefaces.

EDIT : have tried it right now - looks like I cannot influence the styling of the selectitems at all - at least not declaratively in the page. One could try tweaking the theme or overriding the primefaces selectors with custom styling using `!important` rule. But you would still not get distinct styling for the selectitems.

So please excuse my former confidence and regard this answer as a "No, you can't".

Problem

I am using primefaces selectOneButton. I want to make some buttons in that selectOneButton differently styled from others depending upon some backing bean value. Forexample text of 3 buttons in selectOneButton needs to be bold and that of remaining needs to be normal. Is it possible? Primefaces 3.2

Original source