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

Support Box background color #598

Open
isaacs opened this issue Jun 2, 2023 · 2 comments
Open

Support Box background color #598

isaacs opened this issue Jun 2, 2023 · 2 comments

Comments

@isaacs
Copy link
Contributor

isaacs commented Jun 2, 2023

It'd be nice if <Box> could take a backgroundColor property. Currently to render a box with a background color, you have to figure out the max length of all the lines in the box, and create appropriately padded <Text> components, which is a bit of a pain.

The background of a <Box> should be smart enough to restore after a <Text> that sets the background color, so for example:

<Box backgroundColor="blue" paddingY={2} width={1}>
  <Text backgroundColor="red">x</Text>
</Box>

would render an x on a red background, surrounded by 1 block of blue around it.

@vadimdemedes
Copy link
Owner

Old version of Ink used to have this, but it had many issues, so I ended up removing this feature altogether in Ink 3. Might give it another shot again though, but can't promise any ETA.

@vadimdemedes vadimdemedes changed the title Box backgroundColor property Support Box background color Jun 4, 2023
@AKclown
Copy link

AKclown commented Jan 20, 2024

This function feels very useful. I want to highlight the entire row. How should this be achieved?

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants