{"id":15767873,"url":"https://github.com/bubkoo/boxup","last_synced_at":"2025-07-15T04:07:41.529Z","repository":{"id":66336009,"uuid":"55435897","full_name":"bubkoo/boxup","owner":"bubkoo","description":"Wrap content with a box in the terminal","archived":false,"fork":false,"pushed_at":"2016-04-06T05:24:49.000Z","size":126,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-09T23:24:35.650Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bubkoo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-04T18:41:55.000Z","updated_at":"2016-07-28T02:19:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"6a323621-1ed4-41a7-b5a7-3de0fc9d5921","html_url":"https://github.com/bubkoo/boxup","commit_stats":{"total_commits":15,"total_committers":2,"mean_commits":7.5,"dds":0.06666666666666665,"last_synced_commit":"e9185e81fea07a995019891c910217da9a3b057a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bubkoo/boxup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubkoo%2Fboxup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubkoo%2Fboxup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubkoo%2Fboxup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubkoo%2Fboxup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bubkoo","download_url":"https://codeload.github.com/bubkoo/boxup/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubkoo%2Fboxup/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265402468,"owners_count":23759165,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-04T13:41:33.897Z","updated_at":"2025-07-15T04:07:41.507Z","avatar_url":"https://github.com/bubkoo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n![logo.svg](https://cdn.rawgit.com/bubkoo/boxup/28d7fe4/logo.svg)\n\n\n\u003e Wrap content with a box in the terminal.\n\n[![MIT License](https://img.shields.io/badge/license-MIT_License-green.svg?style=flat-square)](https://github.com/bubkoo/boxup/blob/master/LICENSE)\n[![build:?](https://img.shields.io/travis/bubkoo/boxup/master.svg?style=flat-square)](https://travis-ci.org/bubkoo/boxup)\n\n\n## Install\n\n```\n$npm install --save boxup\n```\n\n## Usage\n   \n```js\nvar boxup = require('boxup');\n\nconsole.log(boxup('default options'));\n\n/*\n┌───────────────┐\n|default options|\n└───────────────┘\n*/\n\n\nconsole.log(boxup('textAlign: center, width: 70, margin: 1, padding: 1\\n\\nAmet fringilla fusce nulla praesent mauris, suspendisse lectus aliquam nonummy pharetra, orci eleifend turpis phasellus maecenas bibendum. Posuere interdum in, pede proin dolores metus egestas odio. Nulla minus curabitur iaculis, sit ipsum quam feugiat, libero non malesuada nulla parturient adipiscing, libero ultricies augue ipsum urna.',\n    {\n        width    : 70.\n        margin   : 1,\n        padding  : 1,\n        textAlign: 'center'\n    }));\n\n/*\n\n   ┌────────────────────────────────────────────────────────────────────┐\n   |                                                                    |\n   |         textAlign: center, width: 70, margin: 1, padding: 1        |\n   |                                                                    |\n   |   Amet fringilla fusce nulla praesent mauris, suspendisse lectus   |\n   |    aliquam nonummy pharetra, orci eleifend turpis phasellus maec   |\n   |   enas bibendum. Posuere interdum in, pede proin dolores metus e   |\n   |   gestas odio. Nulla minus curabitur iaculis, sit ipsum quam feu   |\n   |   giat, libero non malesuada nulla parturient adipiscing, libero   |\n   |                     ultricies augue ipsum urna.                    |\n   |                                                                    |\n   └────────────────────────────────────────────────────────────────────┘\n\n\n*/\n```\n\n## API\n\n### boxup(input, [options])\n\n#### input\n\nType: `String`\n\nThe text inside the box.\n\n#### options\n\n##### width\n\nType: `Number`, 'Percentage'\n\nDefault: `auto`\n\nThe width of the box, include padding and borders. \n\n  - `width` is a percentage string, the width is relative to the terminal's width.\n  - `width` is a number, it's a absolute width.\n  - any other invalid values will be treat as `auto`.\n\n  **Note**: if the width is greater than tha terminal's max width,\n  then we will take terminal's max width as the box's width.\n\n\n##### textAlign\n\nType: `String`\n\nDefault: `left`\n\nValues:\n \n- left\n- center\n- right\n\nText alignment in the box.\n\n##### boxAlign\n\nType: `String`\n\nDefault: `left`\n\nValues:\n \n- left\n- center\n- right\n\nThe alignment of the box.\n\n##### borderStyle\n\nType: `String`\n\nDefault: `single`\n\nPredefined values:\n\n- `single`\n```\n  ┌───┐\n  │foo│\n  └───┘\n```\n- `double`\n```\n  ╔═══╗\n  ║foo║\n  ╚═══╝\n```\n- `round` (`single` sides with round corners)\n```\n  ╭───╮\n  │foo│\n  ╰───╯\n```\n- `single-double` (`single` on top and bottom, `double` on right and left)\n```\n  ╓───╖\n  ║foo║\n  ╙───╜\n```\n- `double-single` (`double` on top and bottom, `single` on right and left)\n```\n  ╒═══╕\n  │foo│\n  ╘═══╛\n```\n- `classic`\n```\n  +---+\n  |foo|\n  +---+\n```\n\n##### borderChars\n\nType: `Object`\n\nDefault: `null`\n\nSpecify the ANSII char used to build the box, can have the following keys: \n\n```js\n{\n    topLeft    : '+',\n    topRight   : '+',\n    bottomLeft : '+',\n    bottomRight: '+',\n    top       : '-',\n    bottom    : '-',\n    horizontal: '-',\n    left    : '|',\n    right   : '|',\n    vertical: '|'\n}\n```\n\nWhich `horizontal` defined both `top` and `bottom` chars, as the same `vertical` defined both `left` and `right` chars. \n\nIf we have already specified a border style, such as `single`, we can use this option to midify some char:\n\n```js\nvar options = {\n\tborderStyle: 'single',\n\tborderChars: {\n\t\ttopLeft    : '1',\n    \ttopRight   : '2',\n    \tbottomLeft : '3',\n    \tbottomRight: '4'\n\t}\n};\n```\n\nIf the `borderStyle` is empty or not a valid value, we should define necessary chars to build the box, that's to say, all the corners and all the borders should be specified:\n\n```js\nvar options = {\n\tborderStyle: '', // empty\n\tborderChars: {\n\t    // corners are necessary\n\t\ttopLeft    : '1',\n    \ttopRight   : '2',\n    \tbottomLeft : '3',\n    \tbottomRight: '4',\n    \t\n    \t// borders\n    \ttop   : '-',  // or horizontal: '-'\n    \tbottom: '-',  // or horizontal: '-'\n    \tright : '|',  // or vertical: '|'\n    \tleft  : '|'   // or vertical: '|'\n    \t\n\t}\n};\n```\n\n##### borderColor\n\nType: `String`\n\nValues: \n\n- black \n- red \n- green \n- yellow \n- blue \n- magenta \n- cyan \n- white \n- gray\n\nColor of the box border.\n\n##### dimBorder\n\nType: `Boolean`\n\nDefault: `false`\n\nReduce opacity of the border.\n\n\n##### backgroundColor\n\nType: `String`\n\nValues: \n\n- black \n- red \n- green \n- yellow \n- blue \n- magenta \n- cyan \n- white\n\nColor of the background.\n\n##### margin\n\nType: `Number`, `Array`, `Object`\n\nDefault: `0`\n\nSet the size of the white space around the box.\n\n- `margin` is a `Number`, the `left`/`right` margin is `3` times the `top`/`bottom` to make it look nice.\n- `margin` is an `Array`, the array's item respectively represent the `top`, `right`, `bottom` and `left` margin of the box.\n- `margin` is an `Object`, the object can have any of the `top`, `right`, `bottom`, `left` properties.\n\n**Examples:**\n```js\nvar options = {\n\tmargin: [1, 2, 3, 4]\n};\n/*\n// equal to\nvar options = {\n\tmargin: {\n\t\ttop   : 1,\n\t\tright : 2,\n\t\tbottom: 3,\n\t\tleft  : 4\n\t}\n};\n*/\n```\n\n##### padding\n\nType: `Number`, `Array`, `Object`\n\nDefault: `0`\n\nSpace between the text and box border.\n\n- `padding` is a `Number`, the `left`/`right` padding is `3` times the `top`/`bottom` to make it look nice.\n- `padding` is an `Array`, the array's item respectively represent the `top`, `right`, `bottom` and `left` padding of the box.\n- `padding` is an `Object`, the object can have any of the `top`, `right`, `bottom`, `left` properties.\n\n\n## Related\n\n- [boxup-cli](https://github.com/bubkoo/boxup-cli) - cli for [boxup](https://github.com/bubkoo/boxup)\n- [boxup-preset](https://github.com/bubkoo/boxup-preset) - border style presets for [boxup](https://github.com/bubkoo/boxup)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbubkoo%2Fboxup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbubkoo%2Fboxup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbubkoo%2Fboxup/lists"}