# @material/notched-outline

> The Material Components for the web notched-outline component

Latest version **14.0.0** (published 2022-04-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @material/notched-outline
pnpm add @material/notched-outline
yarn add @material/notched-outline
bun add @material/notched-outline
```

## Health

**Score 28/100 (F)** — status: abandoned.

Positive: has types package; esm support; no vulnerabilities; popular repo.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 14.0.0 |
| Published | 2022-04-28 |
| First published | 2018-03-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/material__notched-outline) |
| Module format | ESM + CommonJS |
| Dependencies | 7 |
| Unpacked size | 204.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 17051 |
| Maintainers | yefim, abhiomkar, azakus, bicknellr, material-admin, aprigogin, patrickrodee, aomarks, emarquez, allanchen, esgonzalez, asyncliz, candysonya, ssuarez, taylorv |
| Keywords | material components, material design, notchedoutline, notched outline |

## Links

- npm: https://www.npmjs.com/package/@material/notched-outline
- Repository: https://github.com/material-components/material-components-web
- Homepage: https://github.com/material-components/material-components-web#readme
- Issues: https://github.com/material-components/material-components-web/issues
- npm.io page: https://npm.io/package/@material/notched-outline

## Dependencies (7)

- [tslib](https://npm.io/package/tslib.md) ^2.1.0
- [@material/rtl](https://npm.io/package/@material/rtl.md) ^14.0.0
- [@material/base](https://npm.io/package/@material/base.md) ^14.0.0
- [@material/shape](https://npm.io/package/@material/shape.md) ^14.0.0
- [@material/theme](https://npm.io/package/@material/theme.md) ^14.0.0
- [@material/floating-label](https://npm.io/package/@material/floating-label.md) ^14.0.0
- [@material/feature-targeting](https://npm.io/package/@material/feature-targeting.md) ^14.0.0

## Recent versions

- 14.0.0 (latest) — 2022-04-28
- 15.0.0-canary.423edc3dc.0 (canary) — 2024-06-26
- 12.0.0-nightly.778a0e8a.0 (nightly) — 2021-07-20
- 4.0.0-alpha.0 (next) — 2019-08-07
- 15.0.0-canary.cfec83c74.0 — 2024-05-20
- 15.0.0-canary.2f5b899bc.0 — 2024-05-20
- 15.0.0-canary.f80ac92b0.0 — 2024-05-02
- 15.0.0-canary.4b35cb7d0.0 — 2024-05-02
- 15.0.0-canary.65c10a622.0 — 2024-04-25
- 15.0.0-canary.311f29a60.0 — 2024-04-23
- 15.0.0-canary.5bebc0064.0 — 2024-04-11
- 15.0.0-canary.68edc03c6.0 — 2024-04-08
- 15.0.0-canary.453a6248a.0 — 2024-03-25
- 15.0.0-canary.819498d8c.0 — 2024-03-15
- 15.0.0-canary.c43b3438b.0 — 2024-02-23
- … 1644 more at https://npm.io/package/@material/notched-outline/versions

## README

<!--docs:
title: "Notched Outline"
layout: detail
section: components
excerpt: "The notched outline is a border around either a Text Field or Select element"
iconId: text_field
path: /catalog/input-controls/notched-outline/
-->

# Notched Outline

The notched outline is a border around all sides of either a Text Field or Select component. This is used for the Outlined variant of either a Text Field or Select.

## Design & API Documentation

<ul class="icon-list">
  <li class="icon-list-item icon-list-item--spec">
    <a href="https://material.io/go/design-text-fields#text-fields-field-variations">Material Design guidelines: Text Field Variations</a>
  </li>
  <li class="icon-list-item icon-list-item--spec">
    <a href="https://material-components.github.io/material-components-web-catalog/#/component/text-field">Demo with Notched Outline on Text Field</a>
  </li>
</ul>

## Installation

```
npm install @material/notched-outline
```

## Basic Usage

### HTML Structure

```html
<span class="mdc-notched-outline">
  <span class="mdc-notched-outline__leading"></span>
  <span class="mdc-notched-outline__notch">
    <span class="mdc-floating-label">Label</span>
  </span>
  <span class="mdc-notched-outline__trailing"></span>
</span>
```

> Note that the [MDC Floating Label](../mdc-floating-label/README.md) component is placed inside the notch element when
> used together with MDC Notched Outline.

> See the [MDC Text Field](../mdc-textfield/README.md#outlined) and
> [MDC Select](../mdc-select/README.md#outlined-select) documentation for
> information on using Notched Outline in the context of those components.

### Styles

```scss
@use "@material/notched-outline/mdc-notched-outline";
```

### JavaScript Instantiation

```js
import {MDCNotchedOutline} from '@material/notched-outline';

const notchedOutline = new MDCNotchedOutline(document.querySelector('.mdc-notched-outline'));
```

> See [Importing the JS component](../../docs/importing-js.md) for more information on how to import JavaScript.

## Style Customization

### CSS Classes

CSS Class | Description
--- | ---
`mdc-notched-outline` | Mandatory. Container for the outline's sides and notch.
`mdc-notched-outline--notched` | Modifier class to open the notched outline.
`mdc-notched-outline--no-label` | Modifier class to use when the floating label is empty or not used.
`mdc-notched-outline__leading` | Mandatory. Element representing the leading side of the notched outline (before the notch).
`mdc-notched-outline__notch` | Mandatory. Element representing the notch.
`mdc-notched-outline__trailing` | Mandatory. Element representing the trailing side of the notched outline (after the notch).

### Sass Mixins

Mixin | Description
--- | ---
`color($color)` | Customizes the border color of the notched outline.
`stroke-width($width)` | Changes notched outline width to a specified pixel value.
`shape-radius($radius, $rtl-reflexive)` | Sets the rounded shape to notched outline element with given radius size. Set `$rtl-reflexive` to true to flip radius values in RTL context, defaults to false.
`floating-label-float-position($positionY, $positionX, $scale)` | Sets the position and scale of the floating label inside the notched outline.

## `MDCNotchedOutline` Properties and Methods

Method Signature | Description
--- | ---
`notch(notchWidth: number) => void` | Opens the notch with the specified width.
`closeNotch() => void` | Closes the notch, rendering a full outline.

## Usage Within Frameworks

If you are using a JavaScript framework, such as React or Angular, you can create a Notched Outline for your framework. Depending on your needs, you can use the _Simple Approach: Wrapping MDC Web Vanilla Components_, or the _Advanced Approach: Using Foundations and Adapters_. Please follow the instructions [here](../../docs/integrating-into-frameworks.md).

### `MDCNotchedOutlineAdapter`

Method Signature | Description
--- | ---
`addClass(className: string) => void` | Adds a class to the notched outline element.
`removeClass(className: string) => void` | Removes a class from the notched outline element.
`setNotchWidthProperty(width: number) => void` | Sets the width of the notch in pixels.
`removeNotchWidthProperty() => void` | Removes the width property from the notch element.

### `MDCNotchedOutlineFoundation`

Method Signature | Description
--- | ---
`notch(notchWidth: number) => void` | Adds the `mdc-notched-outline--notched` class and updates the notch element's style based on `notchWidth`.
`closeNotch() => void` | Removes the `mdc-notched-outline--notched` class.

---
_Source: https://npm.io/package/@material/notched-outline · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
