creating tables #186
-
What is the difference between import termkit from 'terminal-kit'
const term = termkit.terminal
const tableRows = [
['Column1', 'Column2', 'Column3'],
['Row1', 'Row1', 'Row1'],
['Row2', 'Row2', 'Row2'],
['Row3', 'Row3', 'Row3'],
]
const tableProps = {
fit: false,
}
term.createInlineElement(termkit.TextTable, { // <-- how is this
cellContents: [...tableRows],
...tableProps,
})
term.table([...tableRows], { ...tableProps }) // <-- different from this? Both of them produce the exact same output. Do they differ only in the default value of Also, is it possible to set table height to auto? The tables always have padding on the bottom to fit the initial size of the terminal, but i want to have the second table to begin right after the first one ends. Also when the terminal is smaller than the table height, the tables get cropped of from the bottom. I am probably missing something. Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hi @aryan02420 Basically, there is no difference. Now for the why: this lib has two modes, the first one is straight-forward and low-level and is called the inline mode, the second one is called the document model mode where you define a page with widgets (useful for terminal-based application). |
Beta Was this translation helpful? Give feedback.
-
@aryan02420 the blank line is a bug, I wonder when it has appeared, I'm on it. About the crop when the terminal is too small, it will take much longer to fix. Like I said, it used a document model's widget, and those widgets are rendered only on the terminal area (as if it was a screen), it doesn't scroll. |
Beta Was this translation helpful? Give feedback.
-
@aryan02420 Ok it's fixed as of v2.1.7. Thanks for reporting ;) |
Beta Was this translation helpful? Give feedback.
@aryan02420 Ok it's fixed as of v2.1.7.
The crop bug was not an issue after all (I had already done things for supporting that).
Thanks for reporting ;)