I managed to do something that seems to look like what you want. Here is the Stackblitz and here is the code :
import React from 'react';
import { render } from 'react-dom';
import './style.css';
const App = () => {
return (
<div className="container">
<button>
<SvgRenderer text="VII" />
</button>
<button>
<SvgRenderer text="LXXIII" />
</button>
<button>
<SvgRenderer text="LXIII" />
</button>
<button>
<SvgRenderer text="LXXIII" />
</button>
<button>
<SvgRenderer text="LXXXIII" />
</button>
</div>
);
};
const SvgRenderer = ({ text }) => (
<svg
width="100%"
height="100%"
viewBox="0 0 100 50"
preserveAspectRatio="xMinYMid meet"
// style={{ backgroundColor: 'green' }}
>
<text
x="0"
y="45"
fill="black"
lengthAdjust="spacingAndGlyphs"
textLength="100"
>
{text}
</text>
</svg>
);
render(<App />, document.getElementById('root'));
I based this on this post. Since I couldn't manage to make the checked answer to work properly, I used one of the answer bellow, but note that I'm absolutely not a pro svg so there might be a way better answer than mine using SVG (or other answers).
[previous answer] You coud do this by using flexbox. This way you don't need to set with and height. Here is the Stackblitz and here is the code :
import React from 'react';
import { render } from 'react-dom';
import './style.css';
const App = () => {
return (
<div className="container">
<button>some text</button>
<button>Some more text</button>
<button>Some more text longer</button>
<button>Some more text longer again and again</button>
<button>Some more text longer again and again, and again ?</button>
</div>
);
};
render(<App />, document.getElementById('root'));
And some css :
.container {
display: flex;
flex-wrap: wrap
}
.container > button {
flex: 1
}
I used long string in the buttons for the use case, but with roman numerals it should be ok I guess.