
Security News
Official Go SDK for MCP in Development, Stable Release Expected in August
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
fluid-resize-react
Advanced tools
Provide a simple way to scale props to fill a container using binary search. Useful for scaling text sizes to fit a container.
npm install --save fluid-resize-react
function App() {
const renderer = current => (
<span style={{ fontSize: `${current}px` }}>
Lorem ipsum dolor sit amet sed adipiscitur sit adipiscitur a very big
heading that im writing
</span>
);
const style = {
overflow: "hidden",
outline: "1px solid red",
whiteSpace: "nowrap"
};
return (
<div className="App">
<FixedSize style={{ ...style, width: 500, height: 50 }}>
{renderer}
</FixedSize>
<FixedHeight style={{ ...style, height: 100 }}>{renderer}</FixedHeight>
<FixedWidth style={{ ...style, width: 500 }}>{renderer}</FixedWidth>
<FixedWidth style={{ ...style, width: 300 }}>{renderer}</FixedWidth>
<FixedWidth style={{ ...style, width: 200 }}>{renderer}</FixedWidth>
</div>
);
}
Pass a render function to a component as child. The component will call the render function passing the current iteration size as parameter.
You can also provide max value, min value and max iterations as props:
function App() {
const renderer = current => (
<span style={{ fontSize: `${current}px` }}>Test</span>
);
const style = {
overflow: "hidden",
whiteSpace: "nowrap"
};
return (
<div className="App">
<FixedWidth maxSteps={10} min={10} max={12} style={{ ...style }}>
{renderer}
</FixedWidth>
</div>
);
}
This components can be used for text as well for any other usages:
function App() {
const renderer = current => (
<div style={{ display: "flex" }}>
{new Array(Math.floor(current)).fill(0).map(_ => (
<div
style={{
margin: 3,
height: "20px",
width: "20px",
backgroundColor: "blue"
}}
/>
))}
</div>
);
return (
<div className="App">
<FixedWidth
min={1}
max={30}
style={{
overflow: "hidden",
whiteSpace: "nowrap"
}}
>
{renderer}
</FixedWidth>
</div>
);
}
MIT © giulioz
FAQs
Scale props to fill a container using binary search
The npm package fluid-resize-react receives a total of 23 weekly downloads. As such, fluid-resize-react popularity was classified as not popular.
We found that fluid-resize-react demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
Security News
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.