> For the complete documentation index, see [llms.txt](https://docs.mapbox.com/mapbox-search-js/ja/llms.txt)

# Theming

This page includes reference documentation for types related to the `Control Theme API`, used to configure custom styling, icons, and images for **Mapbox Search JS Web** elements.

## Options and Type Definitions

### Theme

The Control Theme API is a way to apply your own design system to Mapbox Search JS Web elements.

Control themes use a combination of CSS variables, custom scoped CSS, and SVG icons.

#### Type

[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)

#### Properties

<table class="table table--fixed table--compact" style="width:100%;table-layout:fixed"><colgroup><col width="28%"><col></colgroup><thead><tr class="bg-gray-faint"><th style="border-top-left-radius:4px">Name</th><th style="border-top-right-radius:4px">Description</th></tr></thead><tbody><tr><td><strong>cssText</strong>&nbsp;<span><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>&nbsp;</td><td><span>Optional CSS text to be inserted into Scoped CSS elements. As such, any CSS will not interact with the rest of the page.<p>Class names are specific to each component's own template — see the <code>theme</code> property documentation on the component you're styling for its available class names.</p></span></td></tr><tr><td><strong>icons</strong>&nbsp;<span><a href="#themeicons">ThemeIcons</a></span>&nbsp;</td><td><span>SVG icon overrides to be applied to the control.</span></td></tr><tr><td><strong>images</strong>&nbsp;<span><a href="#themeimages">ThemeImages</a></span>&nbsp;</td><td><span>Raster image URLs to be applied to the control.</span></td></tr><tr><td><strong>variables</strong>&nbsp;<span><a href="#themevariables">ThemeVariables</a></span>&nbsp;</td><td><span>CSS variables to be applied to the control.</span></td></tr></tbody></table>

#### Example

```js
const theme = {
  variables: {
    fontFamily: 'Avenir, sans-serif',
    unit: '14px',
    padding: '0.5em',
    borderRadius: '0',
    boxShadow: '0 0 0 1px silver',
  }
};

const autofillElement = new MapboxAddressAutofill();
autofillElement.theme = theme;
```

このsection on Themeは役に立ちましたか？[Yes](null)[No](null)

### ThemeVariables

`ThemeVariables` are a collection of CSS variables that style Control Theme API elements.

#### Type

[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)

#### Properties

<table class="table table--fixed table--compact" style="width:100%;table-layout:fixed"><colgroup><col width="28%"><col></colgroup><thead><tr class="bg-gray-faint"><th style="border-top-left-radius:4px">Name</th><th style="border-top-right-radius:4px">Description</th></tr></thead><tbody><tr><td><strong>border</strong>&nbsp;<span><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>&nbsp;</td><td><span>Border color of elements such as modals and listboxes.<p>Analogous to CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/border"><code>border</code></a>.</p></span></td></tr><tr><td><strong>borderRadius</strong>&nbsp;<span><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>&nbsp;</td><td><span>Border radius of elements such as modals and listboxes.<p>Analogous to CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius"><code>border-radius</code></a>.</p></span></td></tr><tr><td><strong>boxShadow</strong>&nbsp;<span><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>&nbsp;</td><td><span>Box shadow of elements such as modals and listboxes.<p>Analogous to CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow"><code>box-shadow</code></a>.</p></span></td></tr><tr><td><strong>colorBackdrop</strong>&nbsp;<span><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>&nbsp;</td><td><span>Backdrop color of body content behind modals.<p>Analogous to CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/color"><code>color</code></a>. <strong>Default</strong>: black with alpha value</p></span></td></tr><tr><td><strong>colorBackground</strong>&nbsp;<span><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>&nbsp;</td><td><span>Background color for elements such as modals and listboxes.<p>Analogous to CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/color"><code>color</code></a>. <strong>Default</strong>: white</p></span></td></tr><tr><td><strong>colorBackgroundActive</strong>&nbsp;<span><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>&nbsp;</td><td><span>Background color for items on press.<p>Analogous to CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/color"><code>color</code></a>. <strong>Default</strong>: dark gray</p></span></td></tr><tr><td><strong>colorBackgroundHover</strong>&nbsp;<span><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>&nbsp;</td><td><span>Background color for items on hover.<p>Analogous to CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/color"><code>color</code></a>. <strong>Default</strong>: light gray</p></span></td></tr><tr><td><strong>colorPrimary</strong>&nbsp;<span><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>&nbsp;</td><td><span>Color of the primary accent color.<p>Analogous to CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/color"><code>color</code></a>. <strong>Default</strong>: variant of blue</p></span></td></tr><tr><td><strong>colorSecondary</strong>&nbsp;<span><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>&nbsp;</td><td><span>Color of the secondary accent color.<p>Analogous to CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/color"><code>color</code></a>. <strong>Default</strong>: blue-gray</p></span></td></tr><tr><td><strong>colorText</strong>&nbsp;<span><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>&nbsp;</td><td><span>Color of the primary text.<p>Analogous to CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/color"><code>color</code></a>. <strong>Default</strong>: dark gray</p></span></td></tr><tr><td><strong>curve</strong>&nbsp;<span><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>&nbsp;</td><td><span>The timing function to use for listbox animations.<p>Analogous to CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function"><code>&lt;easing-function&gt;</code></a>. <strong>Default</strong>: <code>ease-out</code></p></span></td></tr><tr><td><strong>duration</strong>&nbsp;<span><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>&nbsp;</td><td><span>The duration to use for listbox animations.<p>Analogous to CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/time"><code>&lt;time&gt;</code></a>. <strong>Default</strong>: <code>150ms</code></p></span></td></tr><tr><td><strong>fontFamily</strong>&nbsp;<span><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>&nbsp;</td><td><span>Font family.<p>Analogous to CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/font-family"><code>font-family</code></a>. <strong>Default</strong>: Sans-serif <a href="https://systemfontstack.com/">system font stack</a></p></span></td></tr><tr><td><strong>fontWeight</strong>&nbsp;<span><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>&nbsp;</td><td><span>Font weight for body text.<p>Analogous to CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight"><code>font-weight</code></a>. <strong>Default</strong>: normal</p></span></td></tr><tr><td><strong>fontWeightBold</strong>&nbsp;<span><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>&nbsp;</td><td><span>Font weight for headings and item titles.<p>Analogous to CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight"><code>font-weight</code></a>. <strong>Default</strong>: bold</p></span></td></tr><tr><td><strong>fontWeightSemibold</strong>&nbsp;<span><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>&nbsp;</td><td><span>Font weight for subheadings.<p>Analogous to CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight"><code>font-weight</code></a>. <strong>Default</strong>: 600</p></span></td></tr><tr><td><strong>lineHeight</strong>&nbsp;<span><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>&nbsp;</td><td><span>Line height.<p>Analogous to CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/line-height"><code>line-height</code></a>. <strong>Default</strong>: 1.2</p></span></td></tr><tr><td><strong>minWidth</strong>&nbsp;<span><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>&nbsp;</td><td><span>Minimum width of elements such as modals and listboxes.<p>Analogous to CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/length"><code>&lt;length&gt;</code></a>.</p></span></td></tr><tr><td><strong>padding</strong>&nbsp;<span><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>&nbsp;</td><td><span>Padding of items in an element.<p>Analogous to CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/length"><code>&lt;length&gt;</code></a>.</p></span></td></tr><tr><td><strong>paddingFooterLabel</strong>&nbsp;<span><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>&nbsp;</td><td><span>Padding of powered by mapbox label in footer of search listbox.<p>Analogous to CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/length"><code>&lt;length&gt;</code></a>.</p></span></td></tr><tr><td><strong>paddingModal</strong>&nbsp;<span><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>&nbsp;</td><td><span>Padding for contents of modal elements.<p>Analogous to CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/length"><code>&lt;length&gt;</code></a>.</p></span></td></tr><tr><td><strong>spacing</strong>&nbsp;<span><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>&nbsp;</td><td><span>Spacing between items in an element.<p>Analogous to CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/length"><code>&lt;length&gt;</code></a>.</p></span></td></tr><tr><td><strong>unit</strong>&nbsp;<span>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="#expression">Expression</a>)</span>&nbsp;</td><td><span>Unit is the base font size and can be referenced in other variables as multiples of <code>1em</code> .<p>Analogous to <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/font-size"><code>font-size</code></a>.</p></span></td></tr><tr><td><strong>unitHeader</strong>&nbsp;<span>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="#expression">Expression</a>)</span>&nbsp;</td><td><span>Unit header is a derivative of <code>unit</code> and is used for modal headers.<p>Analogous to <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/font-size"><code>font-size</code></a>.</p></span></td></tr></tbody></table>

このsection on ThemeVariablesは役に立ちましたか？[Yes](null)[No](null)

### ThemeIcons

`ThemeIcons` are [SVG icons](https://developer.mozilla.org/en-US/docs/Web/SVG) that are used in Control Theme API elements.

Roughly, icon names and their defaults are the same as [Mapbox's Assembly](https://labs.mapbox.com/assembly/icons/).

Values must be valid SVG plain-text. Unless otherwise noted, icons should be 18px in size and have appropriate dimensions set.

Icons can also be filled with 'currentColor'.

#### Type

[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)

#### Properties

| Name | Description |
| --- | --- |
| **addressMarker** [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)  | Icon for address results in search list box. |
| **close** [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)  | Close icon. |
| **marker** [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)  | Icon for map markers. Can be any size. |
| **question** [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)  | Question mark icon. |
| **search** [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)  | Icon for Search Box input. |
| **street** [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)  | Icon for streets results in search list box. |

#### Example

```js
const icons = {
  close: `
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
  <path fill-rule="evenodd" clip-rule="evenodd" d="M3.79289 3.79289C4.18342 3.40237 4.81658 3.40237 5.20711 3.79289L9 7.58579L12.7929 3.79289C13.1834 3.40237 13.8166 3.40237 14.2071 3.79289C14.5976 4.18342 14.5976 4.81658 14.2071 5.20711L10.4142 9L14.2071 12.7929C14.5976 13.1834 14.5976 13.8166 14.2071 14.2071C13.8166 14.5976 13.1834 14.5976 12.7929 14.2071L9 10.4142L5.20711 14.2071C4.81658 14.5976 4.18342 14.5976 3.79289 14.2071C3.40237 13.8166 3.40237 13.1834 3.79289 12.7929L7.58579 9L3.79289 5.20711C3.40237 4.81658 3.40237 4.18342 3.79289 3.79289Z" fill="currentColor"/>
</svg>
`
}
```

このsection on ThemeIconsは役に立ちましたか？[Yes](null)[No](null)

### ThemeImages

`ThemeImages` are raster images that are used in Control Theme API elements.

There are currently only two images, "toggle default" and "toggle satellite," which specify images for a Map/Satellite toggle button.

Values must be valid URLs accessible by the expected browser environment. [Data URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) and [Blob URLs](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL) are also supported.

#### Type

[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)

#### Properties

| Name | Description |
| --- | --- |
| **styleToggleDefault** [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)  | Image for the "Map" of the Map/Satellite toggle button. |
| **styleToggleSatellite** [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)  | Image for the "Satellite" of the Map/Satellite toggle button. |

このsection on ThemeImagesは役に立ちましたか？[Yes](null)[No](null)

### Expression

Currently, the only expression supported is `['mobile', mobile_value, tablet_and_desktop_value]`.

#### Type

[`"mobile"`, [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)]

このsection on Expressionは役に立ちましたか？[Yes](null)[No](null)