Add a default position x,y of "center"
See original GitHub issueHey there,
I want to make a dialog that sizes to the elements within it but am having trouble doing that AND getting the dialog to be centered on the page.
It would be awesome if we could pass something like:
default={{x:"center", y:"center"}}
That way the dialog could be centered and that expands to fit the elements inside (up to its specified bounds).
Thanks @bokuweb !
Issue Analytics
- State:
- Created 5 years ago
- Reactions:9
- Comments:13 (2 by maintainers)
Top Results From Across the Web
How to center a "position: absolute" element
to center a a position:absolute attribute you need to set left:50% and margin-left: -50% of the width of the div.
Read more >background-position - CSS: Cascading Style Sheets | MDN
The background-position CSS property sets the initial position for each background image. The position is relative to the position layer set ...
Read more >Position and align objects in Pages on Mac
You can position free-floating objects on a page using x and y coordinates. Click an object to select it or select multiple objects....
Read more >Add text descriptions to data points - MATLAB text
text( x , y , z , txt ) positions the text in 3-D coordinates. ... 'left' (default). Sample of left-aligned text. 'center'....
Read more >Position · Bootstrap v5.0
(You can add more position values by adding entries to the ... in combination with the edge positioning utilities, allows you to absolute...
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

Hi @bokuweb Any updates on this? Thank you!
Hi @bokuweb So I tried updating react-rnd to version 3.3 of react-draggable but it wasn’t enough to just do that. I think because react-rnd calculates a position offset from the parent, the initial % translation from the positionOffset prop gets canceled out. You’ll need to take a look at the code I think and tinker with it a bit. I tried editing the react-rnd position offset code but was a little stumped as to how to get it to work perfectly.