Specify the width no longer than needed

I want to specify the maximum width of a frame. If the size of the box is smaller than the maximum width, I want a tight box. This can be done using the autowidth=force option to framed.

\setuppapersize[A5]\defineframed[tightframed][width=5cm,autowidth=force,align=middle]\tightframed{Small}\tightframed{A really really long line that is split at 5cm}

Ruled Frames

\framed allows you to specify specific edges to be ruled.
As an alternative to frame=on (the default), one can specify
topframe=on, etc.
Note that, as the default is to draw a complete frame,
it is necessary to either specify the state (on/off) for all four edges
or include the keyword frame=off.

Rounded Corners

\framed allows you to have round corners with corner=round. There are also other possibilities if you want round corners but not at all places by giving an appropriate number to corner=.... This example is taken from core-rul.tex and each frame is typeset using

\framed[corner=....,frame=on]{...}

You can only fill the frame with a background color if the corner shape is closed. Otherwise, the backgroundcolor option will be silently ignored.

Coloring frame background and framed text

First you have to turn on colors with \setupcolors[state=start]. Then you can define the background and foreground (=text) colors:

In addition, the parameter [strut=no] allows removal of the initial strut when framing text that is Verbatim with line breaks.

Content offsets

Beyond those there is another four dimensions that enable you to control
the safety distance of a \framed’s content by orientation.
Horizontally, loffset governs the left, roffset the right
offset;
the same goes for boffset for the bottom and toffset for
the top distance.
Their effects are explored in the following example (MkIV only).