Get width of <Box>
See original GitHub issueIs it possible to obtain the width of the Box
element in Ink 2.0?
Issue Analytics
- State:
- Created 5 years ago
- Comments:23 (19 by maintainers)
Top Results From Across the Web
Getting Width & Height of an Element in JavaScript
In this tutorial, you will learn how to get the current computed dimension of an element, including width and height, in JavaScript.
Read more >JavaScript get size of content box - dom - Stack Overflow
I need a way to get the size of the content box width and hight in pixels. I'm open to work around's like...
Read more >How to Measure the Length x Width x Height of Shipping Boxes
1. Measure the longest side of the package. Start by identifying the longest side of the package, then hold a ruler or tape...
Read more >box-sizing - CSS: Cascading Style Sheets - MDN Web Docs
The box-sizing CSS property sets how the total width and height of an element is calculated.
Read more >How to Measure Dimensions of a Box - PakFactory Blog
The Three Dimensions of a Box · Length: The longest side when looking at the top of the box. · Width: The shorter...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m thinking about
measureElement
method that Ink could expose that would allow you to measure any element after component is mounted. For example:What do you think?
It does seems to work, but it seems to be not that used in the React ecosystem, isn’t it ?
Moreover, it may be difficult to react to a size change (if you resize your terminal for example).
Another solution might to expose a
onDimensionChanged
callback onBox
, that is called on first rendering and when the box dimension did change, but I’m not really happy with this either ^^