Let's start with something.
You can just place the \widehat
like any other node along the path.
Here I define a hat
key that does all this for you.
sloped
, allow upside down
and midway
make sure that the “tip” follows the slope of the line and stays in the middle irregardless of other settings.
yscale
and yshift
just sacles and moves the hat around so that it looks good. This might need to be adjusted for other fonts.
You can use any symbol here of course and also rotate it however you need.
You can also use any TikZ drawing which is what I have done with the outgoing
pic that is just drawing a orthogonal line to the path.
Code
\documentclass[tikz]{standalone}
\usetikzlibrary{cd}
\tikzcdset{
tikzcd to small/.tip={tikzcd to[scale=.5, sep=+0pt +1]},
edge node/.style={/tikz/every to/.append style={edge node={#1}}},
/tikz/pics/outgoing/.style={
/tikz/sloped, /tikz/allow upside down, code={
\draw[pic actions] (0pt,0pt) -- (up:1ex);}},
outgoing/.style={edge node={pic[-tikzcd to small,#1]{outgoing}}},
outgoing'/.style={edge node={pic[-tikzcd to small,yscale=-1,#1]{outgoing}}},
incoming/.style={edge node={pic[tikzcd to small-,#1]{outgoing}}},
incoming'/.style={edge node={pic[tikzcd to small-,yscale=-1,#1]{outgoing}}},
hat/.style={edge node={
node[sloped, allow upside down, inner sep=+0pt, midway,
yscale=2, yshift=-.6ex]{$\widehat{}$}}}}
\begin{document}
\begin{tikzcd}
A \rar[hat] & B \dlar[hat, bend left] \\
C \uar[outgoing'] \urar[incoming']
\end{tikzcd}
\end{document}
Output
