({{, (RefLink[TextGrid, paclet:ref/TextGrid])[{{(Subscript[expr, 11]),(Subscript[expr, 12]),…},{(Subscript[expr, 21]),(Subscript[expr, 22]),…},…}]
is an object that formats (Subscript[expr, ij]) textually and arranged in a two-dimensional grid. }})

OpenersNotesSection(Spacer1)Details and Options

In a notebook, you can modify the two-dimensional layout resulting from (RefLink[TextGrid, paclet:ref/TextGrid]) by using (Key1[ctrl, ,]) to add columns and (Key1[ctrl, enter]) to add rows. All new columns and rows will use textual formatting.

You can use (Key0[tab]) to move to the next placeholder in a (RefLink[TextGrid, paclet:ref/TextGrid]). (Key1[ctrl, space]) moves out of the whole (RefLink[TextGrid, paclet:ref/TextGrid]).

(RefLink[TextGrid, paclet:ref/TextGrid])[…] formats as a grid in (RefLink[StandardForm, paclet:ref/StandardForm]) and (RefLink[TraditionalForm, paclet:ref/TraditionalForm]).

In (RefLink[InputForm, paclet:ref/InputForm]), (RefLink[TextGrid, paclet:ref/TextGrid])[…] formats literally as (RefLink[TextGrid, paclet:ref/TextGrid])[…].

(RefLink[Normal, paclet:ref/Normal])[grid] extracts the list of lists that make up a grid.

The (Subscript[expr, ij]) can be expressions of any kind. If the expression is a string or a (RefLink[TextCell, paclet:ref/TextCell]), it will format textually. If the expression is a (RefLink[Row, paclet:ref/Row]), then it will format the strings or (RefLink[TextCell, paclet:ref/TextCell]) elements of the (RefLink[Row, paclet:ref/Row]) textually.

(RefLink[Style, paclet:ref/Style])["string","style"] can be used to specify a particular style for a string.

The (Subscript[list, i]) in (RefLink[TextGrid, paclet:ref/TextGrid])[{(Subscript[list, 1]),(Subscript[list, 2]),…}] do not all need to be the same length; there will be empty space in the grid at the ends of shorter rows.

You can specify that an element e should span multiple positions in a grid using, for example, (RefLink[TextGrid, paclet:ref/TextGrid])[{{e,(RefLink[SpanFromLeft, paclet:ref/SpanFromLeft]),(RefLink[SpanFromLeft, paclet:ref/SpanFromLeft])},…}].

The following specify that a particular position should be spanned:

A particular element can span both multiple rows and multiple columns, by having a rectangular section of the array with the form {{e,(RefLink[SpanFromLeft, paclet:ref/SpanFromLeft]),(RefLink[SpanFromLeft, paclet:ref/SpanFromLeft]),…}, {(RefLink[SpanFromAbove, paclet:ref/SpanFromAbove]),(RefLink[SpanFromBoth, paclet:ref/SpanFromBoth]),(RefLink[SpanFromBoth, paclet:ref/SpanFromBoth]),…},…}.

In a notebook, you can combine selected elements in a grid to make a single spanning element using the Make Spanning menu item.

(RefLink[TextGrid, paclet:ref/TextGrid]) has the same options as (RefLink[Grid, paclet:ref/Grid]).

The settings for (RefLink[BaseStyle, paclet:ref/BaseStyle]) are appended to the default style typically given by the "TextGrid" style in the current stylesheet.

OpenersPrimaryExamplesSection(Spacer1)Examples  (6)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Display elements in a grid:

TextGrid[{{"First row:","a line"},{"Second row:","another line"}}]

Put a frame around every element:

TextGrid[{{"First row:","a line"},{"Second row:","another line"}},Frame->All]

OpenersExampleSection1(Spacer1)Scope  (4)

OpenersExampleSubsection0(Spacer1)Elements in Grids  (4)

(RefLink[TextGrid, paclet:ref/TextGrid]) can contain strings and (RefLink[TextCell, paclet:ref/TextCell]) expressions:

TextGrid[{{"black",TextCell["red",Red]}}]

(RefLink[TextGrid, paclet:ref/TextGrid]) can include styled text by using (RefLink[TextCell, paclet:ref/TextCell]) with (RefLink[Row, paclet:ref/Row]) and (RefLink[Style, paclet:ref/Style]):

TextGrid[{{"animal", TextCell[Row[{"the ",Style["big",24],Style[" red ",Red],"dog"}]]}}]

(RefLink[TextGrid, paclet:ref/TextGrid]) can contain graphics or any other expressions:

TextGrid[{{"circle",Graphics[Circle[],ImageSize->30]},{"radical",Sqrt[2]}}]

(RefLink[TextGrid, paclet:ref/TextGrid]) can contain active controls:

TextGrid[{{"checkbox",Checkbox[]},{"radio button",RadioButton[]}}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Grid, paclet:ref/Grid])  ▪  (RefLink[TextCell, paclet:ref/TextCell])  ▪  (RefLink[Text, paclet:ref/Text])  ▪  (RefLink[Multicolumn, paclet:ref/Multicolumn])  ▪  (RefLink[TableForm, paclet:ref/TableForm])  ▪  (RefLink[GalleryView, paclet:ref/GalleryView])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Tables and Matrices, paclet:tutorial/TablesAndMatrices])}, {▪(RefLinkPlain[Grids, Rows, and Columns, paclet:tutorial/GridsRowsAndColumnsOverview])}, {▪(RefLinkPlain[Formatted Output, paclet:tutorial/FormattedOutput])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Layout & Tables, paclet:guide/LayoutAndTables])}, {▪(RefLinkPlain[Grids & Tables, paclet:guide/GridsAndTables])}})}})