bvaughn / react-resizable-panels

https://react-resizable-panels.vercel.app/
MIT License
3.87k stars 135 forks source link

[Enhancement] Support CSS values for defaultSize, maxSize & minSize #277

Closed 11xdeveloper closed 8 months ago

11xdeveloper commented 8 months ago

The Panel component should be able to take CSS values for defaultSize, maxSize & minSize

e.g.

// ...
<Panel
    defaultSize='10svw'
    {/* ... */}
>
// ...

Much more convenient not having to use window.innerWidth / window.innerHeight.

As well as more accurate when it comes to newer values such as dvw, dvh, swv, svh, etc.

bvaughn commented 8 months ago

Panel size constraints are exclusively percentages. No CSS unites– pixel or otherwise– are supported.

The FAQ mentions this:

Can panel sizes be specified in pixels?

No. Pixel-based constraints added significant complexity to the initialization and validation logic and so I've decided not to support them. You may be able to implement a version of this yourself following a pattern like this but it is not officially supported by this library.