Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions docs/api/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface TableOptions {
rows?: RowData[];

// Table styling
style?: TableStyle | CustomStyle;
style?: CustomStyle;

// Sorting function
sort?: (row1: RowData, row2: RowData) => number;
Expand Down Expand Up @@ -72,8 +72,8 @@ const table = new Table({
{ id: 2, name: "Jane", age: 30 }
],

// Table styling
style: "fatBorder",
// Table styling (using default style)
// style: customStyleObject, // Use custom style object if needed
title: "Employee Directory",

// Sorting by age in descending order
Expand Down Expand Up @@ -396,20 +396,22 @@ const table = new Table({

Pre-defined table border styles.

```typescript
type TableStyle = "fatBorder" | "thinBorder" | "noBorder";
```
The style property accepts a `TableStyleDetails` object or can be omitted to use the default style.

**Examples:**
```javascript
// Fat border (thick lines)
const table = new Table({ style: "fatBorder" });

// Thin border (thin lines)
const table = new Table({ style: "thinBorder" });

// No border
const table = new Table({ style: "noBorder" });
// Default border style (will use built-in default style)
const table = new Table();

// Custom border style
const table = new Table({
style: {
headerTop: { left: "┌", mid: "┬", right: "┐", other: "─" },
headerBottom: { left: "├", mid: "┼", right: "┤", other: "─" },
tableBottom: { left: "└", mid: "┴", right: "┘", other: "─" },
vertical: "│"
}
});
```

## Function Signatures
Expand Down
4 changes: 2 additions & 2 deletions docs/api/core-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const table = new Table({
{ name: "name", alignment: "center" },
{ name: "age", alignment: "right", color: "green" }
],
style: "fatBorder",
// Default style will be used (omit style property for default borders)
title: "User Data",
sort: (row1, row2) => row1.id - row2.id,
filter: (row) => row.age >= 18
Expand Down Expand Up @@ -175,7 +175,7 @@ const table = new Table({
],

// Table styling
style: "fatBorder",
// Default style will be used (omit style property for default borders)
title: "Employee Directory",

// Sorting by age in descending order
Expand Down
4 changes: 2 additions & 2 deletions docs/api/table-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ console.log(tableString);
**Advanced Usage:**
```javascript
const table = new Table({
title: "User Report",
style: "fatBorder"
title: "User Report"
// Default style will be used (omit style property for default borders)
});

table.addRows([
Expand Down
2 changes: 1 addition & 1 deletion docs/doc-table-instance-creation.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ new Table(["column1", "column2", "column3"]);

```javascript
new Table({
style: "fatBorder", //style of border of the table, (optional)
// Default style will be used (omit style property for default borders)
columns: [
{ name: "column1", alignment: "left", color: "red" }, //with alignment and color
{ name: "column2", alignment: "right" },
Expand Down
Loading