Update
A better syntax has evolved with time, which has several advantages due to improvements in TikZ and is now recommended.
\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\[
\begin{tikzcd}
& A \arrow[dr,"g"] \\
B \arrow[ur,"f"] \arrow[rr,"h"] && C
\end{tikzcd}
\]
\[
\begin{tikzcd}[row sep=2.5em]
& A \arrow[dr,"g"] \\
B \arrow[ur,"f"] \arrow[rr,"h"] && C
\end{tikzcd}
\]
\[
\begin{tikzcd}[column sep=1.5em]
& A \arrow[dr,"g"] \\
B \arrow[ur,"f"] \arrow[rr,"h"] && C
\end{tikzcd}
\]
\end{document}
Original answer
The basic idea for triangular diagrams is to consider more columns, in this case three; you may want to play with column sep
or row sep
in order to get better distances, as shown.
\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\[
\begin{tikzcd}
& A \arrow{dr}{g} \\
B \arrow{ur}{f} \arrow{rr}{h} && C
\end{tikzcd}
\]
\[
\begin{tikzcd}[row sep=2.5em]
& A \arrow{dr}{g} \\
B \arrow{ur}{f} \arrow{rr}{h} && C
\end{tikzcd}
\]
\[
\begin{tikzcd}[column sep=1.5em]
& A \arrow{dr}{g} \\
B \arrow{ur}{f} \arrow{rr}{h} && C
\end{tikzcd}
\]
\end{document}

If you want to try this with QTikZ, you need a suitable template; create the text file tikz-cd-template.pgs
with
\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
<>
\end{document}
Choose the template and then paste the part of the above code which is between \begin{document}
and \end{document}
in the input window for QTikZ. Here's a picture of the result.
If you have an old version of tikz-cd
(which might be the case on Ubuntu or other GNU/Linux boxes) it may be necessary to start the diagram with {}
:
\[
\begin{tikzcd}
{} & A \arrow{dr}{g} \\
B \arrow{ur}{f} \arrow{rr}{h} && C
\end{tikzcd}
\]
