Setting the Granite UI Switch default state.

Setting the default state of the Granite UI Switch component in AEM 6.x you may think is easy, well to be honest it is, but it did take me 20–30 minutes to work out to do it first off.

Why’s that you say, well the main reason why is because it’s not documented in the Adobe Documentation anywhere so I needed to fish through the codebase to see if there was anything available in the component options but missing from the documentation and low and behold there was… defaultChecked.

So to set the Switch component checked by default all I needed to set was


So now when I open up my Granite UI dialog my Switch component is set to true… Sweet!

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.