%%
%% The LaTeX Companion, 3ed
%%
%% Example 8-4-16 on page I-622 in "Title box maneuvers".
%%
%% Copyright (C) 2022 Frank Mittelbach
%%
%% It may be distributed and/or modified under the conditions
%% of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%%
%% See
https://www.latex-project.org/lppl.txt for details.
%%
\documentclass{tlc3exa}
\pagestyle{empty}
\setcounter{page}{6}
\setlength\textwidth{159.0pt}
%StartShownPreambleCommands
\usepackage[skins]{tcolorbox}
%StopShownPreambleCommands
\begin{document}
\begin{tcolorbox}[enhanced,title=Something fancy,
attach boxed title to top right
= {xshift=3mm,yshift=-3mm,yshifttext=-1mm},
boxed title style={size=fbox,colback=blue}]
A box with the title forming its own box.
\end{tcolorbox}
\end{document}