Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add linebreak prop to various components #36

Merged
merged 2 commits into from
Apr 19, 2024
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
8 changes: 7 additions & 1 deletion docs/pages/docs/components/paragraph.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,19 @@ n.paragraph({
types={['string | string[] | NuiLine | NuiLine[]']}
/>


#### truncate

<Property
types={['boolean']}
/>

#### linebreak

<Property
defaultValue="true"
types={['boolean']}
/>

#### prepare_lines

<Property
Expand Down
7 changes: 7 additions & 0 deletions docs/pages/docs/components/text-input.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ n.text_input({
types={['string']}
/>

#### linebreak

<Property
defaultValue="false"
types={['boolean']}
/>

#### placeholder

> Optional placeholder text to show when the input is empty.
Expand Down
3 changes: 3 additions & 0 deletions lua/nui-components/paragraph.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ function Paragraph:init(props, popup_options)
buf_options = {
filetype = props.filetype or "",
},
win_options = {
linebreak = fn.default_to(props.linebreak, true),
},
}, popup_options)
)
end
Expand Down
1 change: 1 addition & 0 deletions lua/nui-components/text-input.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ function TextInput:init(props, popup_options)
},
win_options = {
wrap = props.wrap,
linebreak = fn.default_to(props.linebreak, false),
},
}, popup_options)
)
Expand Down
Loading