# better-bottomsheet

> Better Bottomsheet

Latest version **1.0.1** (published 2022-08-28) · 0 weekly downloads

## Install

```sh
npm install better-bottomsheet
pnpm add better-bottomsheet
yarn add better-bottomsheet
bun add better-bottomsheet
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2022-08-28 |
| First published | 2022-08-21 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 135.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | nishchay.maurya |
| Keywords | bottomsheet, sheet, dialog, bottom, dialog, nishchay |

## Links

- npm: https://www.npmjs.com/package/better-bottomsheet
- Repository: https://github.com/nishchay3/reusable-but-better
- Homepage: https://nishchay3.github.io/reusable-but-better/
- Issues: https://github.com/nishchay3/reusable-but-better/issues
- npm.io page: https://npm.io/package/better-bottomsheet

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.3.0

## Alternatives

- [csv-to-markdown-table](https://npm.io/package/csv-to-markdown-table.md) — 47.0K weekly downloads
- [@sapphire/ratelimits](https://npm.io/package/@sapphire/ratelimits.md) — 4.4K weekly downloads
- [js-csvparser](https://npm.io/package/js-csvparser.md) — 2.0K weekly downloads
- [@adadapted/js-sdk](https://npm.io/package/@adadapted/js-sdk.md) — 251 weekly downloads
- [@grapecity/spread-sheets-sparklines](https://npm.io/package/@grapecity/spread-sheets-sparklines.md) — 103 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2022-08-28
- 1.0.0 — 2022-08-21

## README

# Better Bottomsheet

Homepage: [nishchay3.github.io/reusable-but-better](https://nishchay3.github.io/reusable-but-better/)

This bottom sheet is inspired by Instagram's reels comment section bottom sheet.

The `BetterBottomSheet` service can be used to open Material Design panels to the bottom of the screen.
These panels are intended primarily as an interaction on mobile devices where they can be used as an
alternative to dialogs and menus.

# Installation

```ts
npm i better-bottomsheet
```

# Usage

<!-- example(bottom-sheet-overview) -->

You can open a bottom sheet by calling the `open` method with a component to be loaded and an
optional config object. The `open` method will return an instance of `BetterBottomSheetRef`:

```ts
const bottomSheetRef = bottomSheet.open(SocialShareComponent, {
  ariaLabel: 'Share on social media',
});
```

The `BetterBottomSheetRef` is a reference to the currently-opened bottom sheet and can be used to close
it or to subscribe to events. Note that only one bottom sheet can be open at a time. Any component
contained inside of a bottom sheet can inject the `MatBottomSheetRef` as well.

```ts
bottomSheetRef.afterDismissed().subscribe(() => {
  console.log('Bottom sheet has been dismissed.');
});

bottomSheetRef.dismiss();
```

### Sharing data with the bottom sheet component.

If you want to pass in some data to the bottom sheet, you can do so using the `data` property:

```ts
const bottomSheetRef = bottomSheet.open(HobbitSheet, {
  data: { names: ['Frodo', 'Bilbo'] },
});
```

Afterwards you can access the injected data using the `BETTER_BS_DATA` injection token:

```ts
import { Component, Inject } from '@angular/core';
import { BETTER_BS_DATA } from 'better-bottomsheet';

@Component({
  selector: 'hobbit-sheet',
  template: 'passed in {{ data.names }}',
})
export class HobbitSheet {
  constructor(@Inject(BETTER_BS_DATA) public data: { names: string[] }) {}
}
```

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