{/* prettier-ignore */}
{/*
Copyright 2023 Comcast Cable Communications Management, LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

SPDX-License-Identifier: Apache-2.0
\*/}

import { Meta } from '@storybook/blocks';

<Meta title="Docs / Theming / Modes" />

# Mode

LightningUI components utilize modes to update `this.style`. The component's appearance can be changed depending on it's mode.

**Common modes include:**

- unfocused (default)
- focused
- disabled
- selected

By default each component will attempt to find a `focused` mode when thte component gains focus.

### Theme Level

You can set any component's default mode by specifying it in the `componentConfig` property of your theme. For a deeper dive on `modes`, see ["Component Config"](?path=/docs/docs-theming-component-config--docs).

{/* prettier-ignore */}
```js 
componentConfig: {
  Tile: {
    mode: 'focused'
  }
}
```

You can also adjust the functionality of a mode by overriding it in your theme using the `styleConfig` property nested inside `componentConfig`.

{/* prettier-ignore */}
```js
componentConfig: {
  Tile: {
    styleConfig: {
      mode: {
        focused: {
          radius: 100
        }
      }
    }
  }
}
```

### Component Level

Modes can be set on individual components as well.

In the example below this instance of a Tile would be shown in it's focused state

{/* prettier-ignore */}
```js
ModeTest: {
  type: Tile,
  mode: 'focused'
  ...
}
```

Mode styles can also be overwritten using the same overwrite syntax as shown above in the theme overrides

```js
ModeTest: {
  type: Tile,
  style: {
    mode: {
      focused: {
        radius: 100
      }
    }
  }
  ...
}
```
