# carden

> Create cards in the terminal

Latest version **4.0.0** (published 2019-07-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install carden
pnpm add carden
yarn add carden
bun add carden
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2019-07-05 |
| First published | 2018-12-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 8 |
| Unpacked size | 17 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ryan Tauriainen |
| Maintainers | mrtarantula |
| Keywords | cli, box, boxes, terminal, term, console, ascii, unicode, border, text, card, cards, boxen |

## Links

- npm: https://www.npmjs.com/package/carden
- Repository: https://github.com/mrtarantula/carden
- Homepage: https://github.com/mrtarantula/carden#readme
- Issues: https://github.com/mrtarantula/carden/issues
- npm.io page: https://npm.io/package/carden

## Dependencies (8)

- [chalk](https://npm.io/package/chalk.md) ^2.4.2
- [camelcase](https://npm.io/package/camelcase.md) ^5.3.1
- [cli-boxes](https://npm.io/package/cli-boxes.md) ^2.2.0
- [term-size](https://npm.io/package/term-size.md) ^2.1.0
- [type-fest](https://npm.io/package/type-fest.md) ^0.5.2
- [ansi-align](https://npm.io/package/ansi-align.md) ^3.0.0
- [widest-line](https://npm.io/package/widest-line.md) ^3.1.0
- [string-width](https://npm.io/package/string-width.md) ^4.1.0

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 4.0.0 (latest) — 2019-07-05
- 3.0.0 — 2019-02-20
- 2.0.1 — 2018-12-31
- 2.0.0 — 2018-12-27
- 1.0.0 — 2018-12-21

## README

# carden [![Build Status](https://travis-ci.org/MrTarantula/carden.svg?branch=master)](https://travis-ci.org/MrTarantula/carden.svg?branch=master)

> Create cards in the terminal. Forked from [sindresorhus/boxen](https://github.com/sindresorhus/boxen). Options are the same, but can be configured independently for the header or content.

![screenshot](media/screenshot.png)

## Install

```bash
$ npm install carden
```

## Usage

```js
const carden = require('carden');

console.log(carden('unicorn', 'unicorn', {padding: 1}));
/*
┌─────────────┐
│             │
│   unicorn   │
│             │
│             │
│   unicorn   │
│             │
└─────────────┘
*/

console.log(carden('unicorn', 'unicorn', {padding: 1, margin: 1, borderStyle: 'double'}));
/*
   ╔═════════════╗
   ║             ║
   ║   unicorn   ║
   ║             ║
   ║             ║
   ║   unicorn   ║
   ║             ║
   ╚═════════════╝
*/
```

## API

### carden(header, content, [options])

#### header

Type: `string`

Text inside the header area.

#### content

Type: `string`

Text inside the content area.

#### options

Type: `object`

The same options object used for `boxen`, but the header and content can also be configured with their own `options` object.

## Examples

```js
// card with blue background for header
console.log(carden('Chidi',
  'You put the Peeps in the chili \npot and it makes it taste bad.', {
  header: {
    backgroundColor: 'blue'
  }
}));
```

![Chidi card](media/chidi.png)

```js
// card with different padding, border colors, and border styles
console.log(carden('Tahani',
  `It's not about who you know. Enlightenment comes from within.

The Dalai Lama texted me that.`, {
  margin: 2, // margin can only be set globally
  header: {
    backgroundColor: 'blue',
    padding: 1
  },
  content: {
    borderStyle: 'classic',
    borderColor: 'yellow'
  }
}));
```

![Tahani card](media/tahani.png)

```js
// card with green double border all around
console.log(carden('Eleanor',
  `That Eleanor is a better Eleanor than this one. And
that is not easy for me to say.

"You're not better than me" was my yearbook quote.`, {
  borderStyle: 'double',
  borderColor: 'green',
  header: {
    backgroundColor: 'blue',
    padding: 1
  }
}));
```

![Eleanor card](media/eleanor.png)

```js
// very customized card
console.log(carden('Jason',
  chalk.black(`I always trust dudes in bow ties. Once, this guy
in a bow tie came up to me at the gun range in a
Jacksonville bus station and said he'd give me
$600 if I put these weird turtles in my duffle
bag and brought them to Daytona Beach.

So I hotwired a swamp boat to Daytona and the guy
paid me the $600. My point is, you always trust
dudes in bow ties.`), {
  padding: 1,
  header: {
    backgroundColor: 'blue',
    borderStyle: 'classic',
    borderColor: 'cyan',
  },
  content: {
    backgroundColor: 'white',
    borderStyle: 'round',
    borderColor: 'yellow'
  }
}));
```

![Jason card](media/jason.png)

## Borders

Borders are the same as [sindresorhus/cli-boxes](https://github.com/sindresorhus/cli-boxes), with two additions (subtractions?):

* `blank` - replaces border characters with spaces, so the card lines up with cards that have borders

* `none` - border is completely removed, no characters in its place

```js
// single
console.log(carden('Janet',
  `Is it an error to act unpredictably and behave in
ways that run counter to how you were programmed
to behave?`, {
  borderStyle: 'single',
  padding: 1,
  header: {
    backgroundColor: 'green'
  },
  content: {
    backgroundColor: 'blue'
  }
}));

// blank
console.log(carden('Janet',
  `Is it an error to act unpredictably and behave in
ways that run counter to how you were programmed
to behave?`, {
  borderStyle: 'blank',
  padding: 1,
  header: {
    backgroundColor: 'green'
 },
  content: {
    backgroundColor: 'blue'
  }
}));

// none
console.log(carden('Janet',
  `Is it an error to act unpredictably and behave in
ways that run counter to how you were programmed
to behave?`, {
  borderStyle: 'none',
  padding: 1,
  header: {
    backgroundColor: 'green'
  },
  content: {
    backgroundColor: 'blue'
  }
}));
```

![Janet](media/janet.png)

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