# Add an icon to a control

Source: https://zotonic.com/cookbook/1579/add-an-icon-to-a-control

URI: https://zotonic.com/id/1579

Language: en

Use icons from the loaded theme and keep the control accessible.

An icon class works only when its font or stylesheet is loaded. The standard admin uses Bootstrap-era icon classes; a custom frontend may use a different set. Inspect the active theme rather than assuming every site loads the same icon library.

For a button in admin:

```django
<button type="button" class="btn btn-default">
    <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
    {_ Search _}
</button>
```

Keep visible text where possible. An icon-only control needs an accessible name such as `aria-label`, and decorative icons should be hidden from assistive technology. Use <a href="/id/1372" class="doc-reference doc-reference-tag"><code>tag#lib</code></a> to include any additional icon assets through the site's normal asset pipeline.

Test the control with the font loaded, with keyboard navigation and at increased zoom. Do not add an old LESS build chain just to copy an icon example.

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/1579?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/1579?language=en>)
