Skip to content
Widget customization

Widget customization

This tutorial is mostly a collection of visual changes to the widget through data-styles attribute.

Full-width widget

The only thing you need to do is to add display: block to data-styles (and make sure form itself is wide enough).

Large widget

There’re 2 things you can do: changing font-size scales everything inside the widget and stretching widget itself is done with display attribute (which by default is inline-block).

Small widget

To “squish” the widget you need to add min-width: 0; to data-styles.

Border customization

Border color is customized with --border variable (a proxy to border CSS property) and border radius is customized with --border-radius

Box shadow

Make sure that container’s parent (or form itself) has the same border-radius so there’re no visual conflicts. Also make sure the container does not have overflow: hidden.

Accent colors

Here’s how to make a red widget. You need to override --border (obviously), then --accent-color, --pie-color and --checkbox-hover-color.

Responsive size

For mobile clients we want to show a smaller widget. We can achieve this using font-size and clamp CSS built-in to have smth like font-size: clamp(18px, 4vw, 20px). Trick can be also used to things like --extra-spacing.

Extra spacing

Depending on preferred widget size, you might want to add more horizontal padding between sides and checkbox and logo. You can achieve that using --extra-spacing.

Forcing color theme

If data-theme="auto", but you want to force a dark theme, you can set CSS color-scheme: dark; on any parent of .private-captcha div. Simple(r) version of that is just setting data-theme="dark" attribute, but this way you can make it more dynamic or add custom logic for your website.

Even more customization

For absolutely custom visualization, you can make Private Captcha widget “invisible” and make your own visualizations based on widget’s callbacks and/or events. You can see an example of it in the linked page.

Last updated on