ShowContents
Details
- With the default setting ShowContents->True, an object displays normally.
- With the setting ShowContents->False, a Style object will not displayed. Any space the object would have taken on the display will still be reserved.
- Objects displayed in a graphics scene will continue to affect automatic sizes and plot ranges in the graphic even when ShowContentsFalse is applied to them.
- ShowContentsDynamic[x] enables dynamic control over visibility that can be connected to a user interface.
Examples
open all close allBasic Examples (2)
Scope (7)
{"fish", Style["fowl", ShowContents -> False]}x + Style[y, ShowContents -> False] ^ 2Hide a user interface element:
Column[{Button["first"], Style[Button["second"], ShowContents -> False], Button["third"]}]Hidden controls do not respond to clicking:
Deploy[Framed[Style[Button["print", Print["clicked!"]], ShowContents -> False]]]Graphics[{Disk[{0, 0}], Style[Disk[{2, 0}], ShowContents -> False], Disk[{4, 0}]}]Hidden shapes affect automatically determined plot ranges:
Graphics[{Style[Disk[{-10, -10}], ShowContents -> False], Disk[{0, 0}], Style[Disk[{10, 10}], ShowContents -> False]}, PlotRange -> Automatic, Axes -> True]Graphics3D[{Cuboid[{0, 0, 0}], Style[Cuboid[{1, 0, 0}], ShowContents -> False], Cuboid[{2, 0, 0}]}]Hidden shapes affect automatically determined plot ranges:
Graphics3D[{Cuboid[{0, 0, 0}], Style[Cuboid[{5, 5, 5}], ShowContents -> False]}, PlotRange -> Automatic, Axes -> True]Hide the contents of an entire cell:
CellPrint[ExpressionCell["fish", "Print", ShowContents -> False]]Connect a checkbox to the value of ShowContents using Dynamic:
{Checkbox[Dynamic[showString]], Style["fish", ShowContents -> Dynamic[showString]]}Similarly, control the visibility of a shape in a graphic:
{Checkbox[Dynamic[showTube]], Graphics3D[{Sphere[{0, 0, 0}], Style[Tube[{{0, 0, 0}, {5, 5, 5}}, .5], ShowContents -> Dynamic[showTube]], Sphere[{5, 5, 5}]}]}Properties & Relations (2)
Invisible is effectively the same as Style[expr,ShowContentsFalse]:
{Invisible[123], Style[123, ShowContents -> False]}ShowContents is more flexible, since its value can be controlled with Dynamic:
{Checkbox[Dynamic[x]], Dynamic[x], Style[123, ShowContents -> Dynamic[x]]}Use Spacer to display a blank space with the size specified in printer's points:
Framed[Spacer[{70, 50}]]History
Introduced in 1999 (4.0)
Text
Wolfram Research (1999), ShowContents, Wolfram Language function, https://reference.wolfram.com/language/ref/ShowContents.html.
CMS
Wolfram Language. 1999. "ShowContents." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ShowContents.html.
APA
Wolfram Language. (1999). ShowContents. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ShowContents.html
BibTeX
@misc{reference.wolfram_2026_showcontents, author="Wolfram Research", title="{ShowContents}", year="1999", howpublished="\url{https://reference.wolfram.com/language/ref/ShowContents.html}", note=[Accessed: 15-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_showcontents, organization={Wolfram Research}, title={ShowContents}, year={1999}, url={https://reference.wolfram.com/language/ref/ShowContents.html}, note=[Accessed: 15-June-2026]}