` to create our custom control. Structurally, this is the same approach as our default `.form-check`.
We use the sibling selector (`~`) for all our `
` states—like `:checked`—to properly style our custom form indicator. When combined with the `.custom-control-label` class, we can also style the text for each item based on the `
`'s state.
We hide the default `
` with `opacity` and use the `.custom-control-label` to build a new custom form indicator in its place with `::before` and `::after`. Unfortunately we can't build a custom one from just the `
` because CSS's `content` doesn't work on that element.
In the checked states, we use **base64 embedded SVG icons** from [Open Iconic](https://github.com/iconic/open-iconic). This provides us the best control for styling and positioning across browsers and devices.
#### Checkboxes
{{< example >}}
Check this custom checkbox
{{< /example >}}
Custom checkboxes can also utilize the `:indeterminate` pseudo class when manually set via JavaScript (there is no available HTML attribute for specifying it).
If you're using jQuery, something like this should suffice:
```js
$('.your-checkbox').prop('indeterminate', true)
```
#### Radios
{{< example >}}
Toggle this custom radio
Or toggle this other custom radio
{{< /example >}}
#### Inline
{{< example >}}
Toggle this custom radio
Or toggle this other custom radio
{{< /example >}}
#### Disabled
Custom checkboxes and radios can also be disabled. Add the `disabled` boolean attribute to the `
` and the custom indicator and label description will be automatically styled.
{{< example >}}
Check this custom checkbox
Toggle this custom radio
{{< /example >}}
### Switches
A switch has the markup of a custom checkbox but uses the `.custom-switch` class to render a toggle switch. Switches also support the `disabled` attribute.
{{< example >}}
Toggle this switch element
Disabled switch element
{{< /example >}}
### Select menu
Custom `
` menus need only a custom class, `.custom-select` to trigger the custom styles. Custom styles are limited to the ``'s initial appearance and cannot modify the ``s due to browser limitations.
{{< example >}}
Open this select menu
One
Two
Three
{{< /example >}}
You may also choose from small and large custom selects to match our similarly sized text inputs.
{{< example >}}
Open this select menu
One
Two
Three
Open this select menu
One
Two
Three
{{< /example >}}
The `multiple` attribute is also supported:
{{< example >}}
Open this select menu
One
Two
Three
{{< /example >}}
As is the `size` attribute:
{{< example >}}
Open this select menu
One
Two
Three
{{< /example >}}
### Range
Create custom ` ` controls with `.custom-range`. The track (the background) and thumb (the value) are both styled to appear the same across browsers. As only IE and Firefox support "filling" their track from the left or right of the thumb as a means to visually indicate progress, we do not currently support it.
{{< example >}}
Example range
{{< /example >}}
Range inputs have implicit values for `min` and `max`—`0` and `100`, respectively. You may specify new values for those using the `min` and `max` attributes.
{{< example >}}
Example range
{{< /example >}}
By default, range inputs "snap" to integer values. To change this, you can specify a `step` value. In the example below, we double the number of steps by using `step="0.5"`.
{{< example >}}
Example range
{{< /example >}}
### File browser
{{< callout info >}}
The recommended plugin to animate custom file input: [bs-custom-file-input](https://www.npmjs.com/package/bs-custom-file-input), that's what we are using currently here in our docs.
{{< /callout >}}
The file input is the most gnarly of the bunch and requires additional JavaScript if you'd like to hook them up with functional *Choose file...* and selected file name text.
{{< example >}}
Choose file
{{< /example >}}
We hide the default file ` ` via `opacity` and instead style the ``. The button is generated and positioned with `::after`. Lastly, we declare a `width` and `height` on the ` ` for proper spacing for surrounding content.
#### Translating or customizing the strings with SCSS
The [`:lang()` pseudo-class](https://developer.mozilla.org/en-US/docs/Web/CSS/:lang) is used to allow for translation of the "Browse" text into other languages. Override or add entries to the `$custom-file-text` Sass variable with the relevant [language tag](https://en.wikipedia.org/wiki/IETF_language_tag) and localized strings. The English strings can be customized the same way. For example, here's how one might add a Spanish translation (Spanish's language code is `es`):
```scss
$custom-file-text: (
en: "Browse",
es: "Elegir"
);
```
Here's `lang(es)` in action on the custom file input for a Spanish translation:
{{< example >}}
Seleccionar Archivo
{{< /example >}}
You'll need to set the language of your document (or subtree thereof) correctly in order for the correct text to be shown. This can be done using [the `lang` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang) on the `` element or the [`Content-Language` HTTP header](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.12), among other methods.
#### Translating or customizing the strings with HTML
Bootstrap also provides a way to translate the "Browse" text in HTML with the `data-browse` attribute which can be added to the custom input label (example in Dutch):
{{< example >}}
Voeg je document toe
{{< /example >}}