# How can I add some caption to parbox

I am using

\noindent\fbox{%
\parbox{\textwidth}{%
text
}%
}


For a box around text like this:

How can I add some caption and use this caption as reference in text?

Somethink like this:

You can use adjustbox for this. Use either the float or nofloat key. You need to define a new float type in either case, e.g. using newfloat package.

\documentclass{article}
\usepackage{lipsum}% for example text only

\usepackage{newfloat}

\DeclareFloatingEnvironment[
fileext=loc,
listname={List of cars},
name=Car,
placement=pbth,
within=section,
%chapterlistsgaps=off,
]{car}

\begin{document}
\section{Bla}
\lipsum