# @hig/surface

> HIG Surface component

Latest version **2.2.0** (published 2022-08-28) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @hig/surface
pnpm add @hig/surface
yarn add @hig/surface
bun add @hig/surface
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2022-08-28 |
| First published | 2019-02-14 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 21.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 195 |
| Author | Autodesk Inc. |
| Maintainers | hig-bot, devfoncy, nfiniteset, wmui51, staceyshk, grantkellyadsk |

## Links

- npm: https://www.npmjs.com/package/@hig/surface
- Repository: https://github.com/Autodesk/hig
- Homepage: https://github.com/Autodesk/hig#readme
- Issues: https://github.com/Autodesk/hig/issues
- npm.io page: https://npm.io/package/@hig/surface

## Dependencies (2)

- [emotion](https://npm.io/package/emotion.md) ^10.0.0
- [prop-types](https://npm.io/package/prop-types.md) ^15.7.1

## Recent versions

- 2.2.0 (latest) — 2022-08-28
- 2.1.1 — 2022-03-17
- 2.1.0 — 2022-01-24
- 2.0.0 — 2022-01-13
- 1.2.2 — 2022-01-12
- 1.2.1 — 2022-01-12
- 1.2.0 — 2021-02-24
- 1.1.1 — 2020-05-12
- 1.1.0 — 2020-02-21
- 1.0.1 — 2019-03-13
- 1.0.0 — 2019-02-14

## README

# Surface

The Surface component renders a themable container with the appropriate background color for the current theme. It is intended to wrap other HIG components, however may also be used independently. 

## Getting started

```
yarn add @hig/surface @hig/theme-context @hig/theme-data
```

## Import the component

```
import Surface from '@hig/surface';
```

## Basic usage

```jsx
<Surface
  level=200
  horizontalPadding="m"
  verticalPadding="m"
  shadow="high"
  borderRadius="m"
>Hello, world</Surface>
```
## Custom CSS

Use the `className` prop to pass in a css class name to the outermost container of the component. The class name will also pass down to most of the other styled elements within the component.

Surface also has a `stylesheet` prop that accepts a function wherein you can modify its styles. For instance

```jsx
import Surface from '@hig/surface';

function YourComponent() {
  // ...
  const customStylesheet = (styles, props, themeData) => ({
    ...styles,
    surface: {
      ...styles.surface,
      color: themeData["colorScheme.status.error"]
    }
  });

  return (
    <Surface stylesheet={customStylesheet} />
  );
}
```

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