I'm trying to create a reusable style (let's call it titlerect) for a tikz node which is supposed to look something like the following figure I quickly whipped up in Inkscape:
I imagine it should be usable like
\node[titlerect, title={The title}] at (0,0) {The content};
Quite honestly, however, I don't even know where to start so there's currently no MWE I can provide. I would be grateful for any pointers on how I might go about creating such a style.


#with####as explained here. – May 04 '19 at 06:09\tikzset{titlerect/.style={draw,inner ysep=2ex,inner xsep=1ex,minimum width={2*width("#1")},align=center,label={[anchor=center,fill=white,font=\Large\bfseries\sffamily]above:#1}}}in the preamble of the document, which would make the style global. – May 04 '19 at 06:16\node[titlerect=title, green]. I also tried\node[titlerect=title, label={[text=green]}], which does not seem to work. The text inside the node is changed as desired, just not the label. – May 04 '19 at 10:40titlerect/.style 2 args={}and using it like\node[titlerect={title}{green}]. While this also requires specifying a color when a default one should be used, it's good enough for my purposes. – May 04 '19 at 11:00