Scroll back to top
"Components" and "elements" will be used interchangeably throughout this document. Use the navigation bar to find the component you are interested in.
The starter page contains the basics to get you started, such as section content, navigation bar, adding an image, and adding equations. This syle guide contains indepth information about formatting, branding, and template code for different components. When clicking on template code blocks, the code in the block will be copied to your clipboard.
Potential solutions to common problems when creating pages are on the troubleshooting page. If a problem is still unsolvable after consulting the troubleshooting page, please submit an official issue on the github.
Text successfully copied to clipboard!
import Component from '../../components/Component.astro'
`Component` refers to the name of the component you want to import.
All tags must be closed, which means when you add an element to the page, you must close it to indicate the beginning and the end of that element.
Elements can be in two states: regular or self-closed. Regular means it follows the convention below.Text successfully copied to clipboard!
<Component> Content goes here... </Component>
Notice how the component has two tags, one start tag and one end tag with a forward-slash. This allows us to insert content inside the element when supported.
Self-closing tags follow another convention.Text successfully copied to clipboard!
<Component />
Now, the component only has one tag, essentially combining both the start and end tag. The component will still load, but we cannot insert any content inside it.
Depending on that state, the behavior of the component might be different.
For example, let's take the `<DisplayEquation>` component. When declared with self closing tags, it will simply be displaying an equation that take up the entire width of the screen (or whichever element it's inside of):Text successfully copied to clipboard!
<DisplayEquation title="Normalization to unit vector." id="rvv-eu1" background="True" equation="\\begin{aligned} \\hat{a} =\\frac{\\vec{a}}{a}\\end{aligned}"/>
Text successfully copied to clipboard!
<DisplayEquation title="Normalization to unit vector." id="rvv-eu2" background="True" equation="\begin{aligned} \\hat{a} =\\frac{\\vec{a}}{a}\\end{aligned}" derivation="True">
<p>Content goes here:</p>
<DisplayEquation equation="\\vec{v} = \\vec{\\omega} \\times \\vec{r}"/>
</DisplayEquation>
For U of I affiliated pages, use the university specified branding. To change the color to text, you can either enter a hex code, or type in common color names.
Text successfully copied to clipboard!
<span style="color: #000000">Text</span>
For handdrawn figures, use whatever color scheme you prefer, but make it consistent throughout the course.
For example, solid mechanics uses the following pallete for images:The general format for a page is as follows. Parts can be removed as needed, but try not to rearrange them.
Page section order:Text successfully copied to clipboard!
import Section from "../../components/Section.astro"
Tag type: Regular
Options:Text successfully copied to clipboard!
<Section title="Title" id="example-page">
<p>TEXT</p>
</Section>
TEXT
Text successfully copied to clipboard!
import SubSection from "../../components/SubSection.astro"
Tag type: Regular
Options:Text successfully copied to clipboard!
<SubSection title="Section" id="example-section">
<p>TEXT</p>
</SubSection>
TEXT
Text successfully copied to clipboard!
import SubSection from "../../components/SubSubSection.astro"
Tag type: Regular
Options:Text successfully copied to clipboard!
<SubSubSection title="SubSection" id="example-sub-section">
<p>TEXT</p>
</SubSubSection>
TEXT
Text successfully copied to clipboard!
import SubSection from "../../components/SubSubSubSection.astro"
Tag type: Regular
Options:Text successfully copied to clipboard!
<SubSubSubSection title="SubSubSection" id="example-sub-sub-section">
<p>TEXT</p>
</SubSubSubSection>
TEXT
Tag type: Regular
Options:Text successfully copied to clipboard!
<p> TEXT </p>
TEXT
Use when 2 or more things need to be listed.
Text successfully copied to clipboard!
import Itemize from "../../components/Itemize.astro"
import Item from "../../components/Item.astro"
Tag type: Regular
Options:Text successfully copied to clipboard!
<Itemize>
<Item>TEXT</Item>
<Item>TEXT</Item>
</Itemize>
Use when 2 or more things are in a process or order.
Text successfully copied to clipboard!
import Enumerate from "../../components/Enumerate.astro"
import Item from "../../components/Item.astro"
Tag type: Regular
Options:Text successfully copied to clipboard!
<Enumerate>
<Item>TEXT</Item>
<Item>TEXT</Item>
</Enumerate>
Text successfully copied to clipboard!
import Row from "../../components/Row.astro"
import Col from "../../components/Col.astro"
Tag type: Regular
Options:xs | sm | md | lg | xl | xxl | |
---|---|---|---|---|---|---|
Size of screen | <576px | ≥576px | ≥768px | ≥992px | ≥1200px | ≥1400px |
Prefix | None | sm- | md- | lg- | xl- | xxl- |
A really powerful tool to create a responsive grid. These elements follow the same naming convention as the `Bootstrap` package. More details HERE. These elements treat the full width of the page as 12 units wide, and each `Col` can be defined to take however many units are necessary. Different values can be set for depending on the size of the screen. For example:
Example:Text successfully copied to clipboard!
<Row>
<Col values="12 lg-6">
<p>
Row1Col1
</p>
</Col>
<Col values="12 lg-6">
<p>
Row1Col2
</p>
</Col>
</Row>
This means that by default, each column will be 12 units wide (full-screen), and if the screen is bigger than the `lg` value (in this case >992px), then it will only be 6 units wide (half-screen). Try reducing the size of your browser window, and notice how past a certain point, both elements below stack on top of each other.
Row1Col1
Row1Col2
This can be extended to many more `Col` elements. For example,
Text successfully copied to clipboard!
<Row>
<Col values="12 sm-6 md-4 lg-3">
<p>
Row1Col1
</p>
</Col>
<Col values="12 sm-6 md-4 lg-3">
<p>
Row1Col2
</p>
</Col>
<Col values="12 sm-6 md-4 lg-3">
<p>
Row1Col3
</p>
</Col>
<Col values="12 sm-6 md-4 lg-3">
<p>
Row1Col4
</p>
</Col>
</Row>
The above code means that when the screen is bigger than `lg` each element will occupy 1/4th of the screen. When between `lg` and `md`, it will occupy 1/3rd. When between `md` and `sm`, it will occupy 1/2, and below that will take up the entire screen. Resize your browser to see this behavior.
Row1Col1
Row1Col2
Row1Col3
Row1Col4
Tag type: Regular
Options:Text successfully copied to clipboard!
<em>TEXT</em>
TEXT Tag type: Regular
Options:Text successfully copied to clipboard!
<strong>TEXT</strong>
TEXT Tag type: Regular
Options:Text successfully copied to clipboard!
<u>TEXT</u>
TEXT Tag type: Regular
Options:Text successfully copied to clipboard!
<span style="color: green;">TEXT</span>
TEXTMechref has three U of I specific colors defined as variables:
Text successfully copied to clipboard!
<span style="color: var(--illini-blue);">Text, </span><span style="color: var(--altgeld-orange);">and more text</span>
Text, and more textMake sure to wrap the variable with `var()`, and to not forget the `--`.
Tag type: Regular
How to use:Text successfully copied to clipboard!
<div slot="navtree">
<ul class='list-group list-group-flush py-0'>
<li class='list-group-item py-0'><a class='text-decoration-none subsection' href='#id'>PgSectionTitle</a></li>
<li class='list-group-item py-0'><a class='text-decoration-none subsection' href='#id'> PgSectionTitle </a>
<ul class='list-group list-group-flush py-0'>
<li class='list-group-item py-0'><a class='text-decoration-none subsubsection' href='#id'> PgSubSectionTitle </a></li>
<li class='list-group-item py-0'><a class='text-decoration-none subsubsection' href='#id'> PgSubSectionTitle </a>
<ul class='list-group list-group-flush py-0'>
<li class='list-group-item py-0'><a class='text-decoration-none subsubsubsection' href='#id'> PgSubSubSectionTitle </a></li>
<li class='list-group-item py-0'><a class='text-decoration-none subsubsubsection' href='#id'> PgSubSubSectionTitle </a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
The material properties page in solid mechanics is a good example of multiple subsections being used.
Tag type: Regular
Options:Text successfully copied to clipboard!
<a href="#id ">TEXT</a>
TEXT*For demonstration purposes, this links to the navigation bar section.
Tag type: Regular
Options:Text successfully copied to clipboard!
<a href="/xxx/CoursePage">TEXT</a>
TEXT*For demonstration purposes, this links to vectors page in dynamics.
Tag type: Regular
Options:Text successfully copied to clipboard!
<a target="_blank" rel="noopener noreferrer" href="LINK">TEXT</a>
TEXT*For demonstration purposes, this links to a wikipedia page.
Tag type: Regular
Options:Text successfully copied to clipboard!
<p class="m-0"><u>TEXT</u></p>
<iframe src="LINK" class="w-100" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
TEXT
*For demonstration purposes, this links to a YouTube video.
There are 3 main callout card templates which are all shown here.
Text successfully copied to clipboard!
import CalloutCard from "../../components/CalloutCard.astro"
import CalloutContainer from "../../components/CalloutContainer.astro"
Tag type: Regular
Options:This card is used to connect back to material prior in the course or potential courses they may have already taken.
Note: this information should not be needed to understand the material for the course, this is so students can see how courses connect to each other. Pages should be self-contained and not require links to other material.Text successfully copied to clipboard!
<CalloutContainer slot="cards">
<CalloutCard title="Review?">
<p>
Need a review of <strong> SubSectionTitle </strong>?
</p>
<p>
This content has also been in <a href="/XXX/CoursePage">CourseName</a>
</p>
<p>
CONTENT
</p>
</CalloutCard>
</CalloutContainer>
Review?
This card is used to include supplemental material (ie; videos, webpages, open-source textbooks, etc.).
Text successfully copied to clipboard!
<CalloutContainer slot="cards">
<CalloutCard title="Extra!">
<p class="m-0"><u>Supplemental video:</u></p>
CONTENT
</CalloutCard>
</CalloutContainer>
Extra!
Supplemental MATERIAL:
CONTENTThis card is used to connect to future content in the course or other courses students may take in the future.
Text successfully copied to clipboard!
<CalloutContainer slot="cards">
<CalloutCard title="Heads up!">
<p>
<strong> SubSectionTitle </strong> builds on this content in COURSE.
</p>
<p>
CONTENT
</p>
</CalloutCard>
</CalloutContainer>
Heads up!
SubSectionTitle builds on this content in COURSE.
CONTENT
Text successfully copied to clipboard!
import Image from "../../components/Image.astro"
Tag type: Self-closing (no caption) or regular (caption)
Options:Example:
Text successfully copied to clipboard!
<Image src="/COURSE/FigFolder/FIGURE.png" width="7"> CAPTION</Image>
Text successfully copied to clipboard!
<Image src="/COURSE/FigFolder/FIGURE.png" width="7"/>
Text successfully copied to clipboard!
import Plotly from "../../components/Plotly.astro"
Options:
Mechref has support for integrating Plotly graphs. This very powerful library allows you to create interactive graphs in Python, and export them to a `.json` file, which can be loaded by Mechref. Plotly can be used to generate many types of graphs: line-charts, scatter plots, bar charts, histograms, etc. If you have never used this library before, we recommend starting with this page, which will show you how to make a basic line-chart. ChatGPT has also been a surprisingly reliable source of information on the many options one can add to a graph to make it look and feel exactly as desired.
Once you have exported your graph data, place it in the same folder that you would an image. For example, if you wanted to add your graph to your first page, you would get:
Text successfully copied to clipboard!
public
|--> <course_abbreviation>
|--> <page_1>
|--> <graph_name>.json
src
|--> components
|--> layouts
|--> pages
|--> <course_abbreviation>
|--> <page_1>.astro
And in this case, you would load your graph using in the following way:
Text successfully copied to clipboard!
<Plotly id="graph" file_path="<course_abbreviation>/<page_1>/<graph_name>.json"/>
Result:
\( \LaTeX \) can be used inside your pages. Just like in Latex, we differentiate between inline-math and display-math. One difference betweem \( \LaTeX \) and these pages is when writing math in \( \LaTeX \), you use one backslash \( (\backslash) \), but in the reference pages you need to use two \( (\backslash \backslash) \).
Text successfully copied to clipboard!
import InlineEquation from "../../components/InlineEquation.astro"
Type: Self-closing
Options:Text successfully copied to clipboard!
TEXT <InlineEquation equation="eq" /> TEXT.
TEXT \( eq \) TEXT.
Text successfully copied to clipboard!
import DisplayEquation from "../../components/DisplayEquation.astro"
Type: Self-closing (no derivation) or regular (derivation)
Options:Text successfully copied to clipboard!
<DisplayEquation equation="eq" title="TITLE" background="True" />
Text successfully copied to clipboard!
<DisplayEquation equation="\begin{align} eq1 \\ eq2 \\ eq3 \end{align}" title="TITLE" background="True" />
Text successfully copied to clipboard!
<DisplayEquation equation="eq" title="TITLE" background="True" derivation="True" id="ID">
<DisplayEquation equation="eq" />
<DisplayEquation equation="eq" />
</DisplayEquation>
Text successfully copied to clipboard!
import DisplayEquationCustom from "../../components/DisplayEquationCustom.astro"
Type: Regular only
Options:Text successfully copied to clipboard!
<DisplayEquationCustom title="TITLE" id="id" background="True" derivation="True">
<div class="w-100 d-flex flex-row">
<div class="w-50">
<InlineCanvas id="rcm-er-c" width="300" height="300" show_border="False" />
</div>
<div class="w-50">
<DisplayEquation equation="eq" />
</div>
</div>
<div slot="derivation">
<DisplayEquation equation="eq" />
<DisplayEquation equation="eq" />
</div>
</DisplayEquationCustom>
Text successfully copied to clipboard!
import DisplayTable from "../../components/DisplayTable.astro"
Type: Regular only
Options:Note: The header content should be wrapped within the `thead` element, and the body content should be wrapped within a `tbody` element. There should only be one of each in your table. This allows for proper styling on our end, and is the HTML standard browsers expect, therefore deviating from this might break the look of your tables.
Example:Text successfully copied to clipboard!
<DisplayTable id="id" class_="mb-3">
<thead>
<tr>
<th class="table-shaded" noborder>Title1</th>
<th class="table-shaded">Title2</th>
<th class="table-shaded">Title3</th>
<th class="table-shaded">Title4</th>
</tr>
</thead>
<tbody>
<tr>
<td>row1col1</td>
<td>row1col2</td>
<td>row1col3</td>
<td>row1col4</td>
</tr>
<tr>
<td>row2col1</td>
<td>row2col2</td>
<td>row2col3</td>
<td>row2col4</td>
</tr>
</tbody>
</DisplayTable>
Title1 | Title2 | Title3 | Title4 |
---|---|---|---|
row1col1 | row1col2 | row1col3 | row1col4 |
row2col1 | row2col2 | row2col3 | row2col4 |
The default settings will auto-adjust the column widths to fit the content placed in the cell. To specify a width for a given column, use 'style="width:##%" ' in appropriate the header component.
Example:Text successfully copied to clipboard!
<DisplayTable id="id" class_="mb-3">
<thead>
<tr>
<th class="table-shaded" noborder>Title1</th>
<th class="table-shaded" style="width:50%">Title2</th>
<th class="table-shaded">Title3</th>
<th class="table-shaded">Title4</th>
</tr>
</thead>
<tbody>
<tr>
<td>row1col1</td>
<td>row1col2</td>
<td>row1col3</td>
<td>row1col4</td>
</tr>
<tr>
<td>row2col1</td>
<td>row2col2</td>
<td>row2col3</td>
<td>row2col4</td>
</tr>
</tbody>
</DisplayTable>
Title1 | Title2 | Title3 | Title4 |
---|---|---|---|
row1col1 | row1col2 | row1col3 | row1col4 |
row2col1 | row2col2 | row2col3 | row2col4 |
Example:
Text successfully copied to clipboard!
<DisplayTable id="id" class_="mb-3">
<thead>
<tr>
<th noborder>Title1</th>
<thclass="table-shaded">Title2</th>
<th>Title3</th>
<th>Title4</th>
</tr>
</thead>
<tbody>
<tr>
<td>row1col1</td>
<td class="table-shaded">row1col2</td>
<td>row1col3</td>
<td>row1col4</td>
</tr>
<tr>
<td>row2col1</td>
<td class="table-shaded">row2col2</td>
<td>row2col3</td>
<td>row2col4</td>
</tr>
</tbody>
</DisplayTable>
Title1 | Title2 | Title3 | Title4 |
---|---|---|---|
row1col1 | row1col2 | row1col3 | row1col4 |
row2col1 | row2col2 | row2col3 | row2col4 |
Text successfully copied to clipboard!
import Example from "../../components/Example.astro"
Tag type: Regular
Options:Text successfully copied to clipboard!
<Example id="ID" title="TITLE" solution="True">
<div class="d-flex flex-row">
<Row>
<Col values="12 md-4">
<p>
QUESTION
</p>
</Col>
<Col values="12 md-8">
<Image src="IMAGE " width="7"></Image>
</Col>
</Row>
</div>
<div slot="solution">
<p>
CONTENT
</p>
</div>
</Example>
Tag type: none
Options:Text successfully copied to clipboard!
<em>Note: </em> TEXT.
Note: TEXT.
Text successfully copied to clipboard!
import Warning from "../../components/Warning.astro"
Tag type: Self-closing (does not expand) or regular (expands)
Options:Expands.
Text successfully copied to clipboard!
<Warning title="TITLE" id="id">
CONTENT
</Warning>
Does not expand.
Text successfully copied to clipboard!
<Warning title="TITLE" id="ID_2" remove_button="True"/>
Text successfully copied to clipboard!
import CodeBox from "../../components/CodeBox.astro"
Tag type: Self closing
Options:Open
Text successfully copied to clipboard!
<CodeBox language="html" code=`
CODE
` id="test1" />
Text successfully copied to clipboard!
CODE
Closed
Text successfully copied to clipboard!
<CodeBox language="javascript" code=`
function lorem(ipsum, dolor = 1) {
const sit = ipsum == null ? 0 : ipsum.sit;
dolor = sit - amet(dolor);
return sit ? consectetur(ipsum, 0, dolor < 0 ? 0 : dolor) : [];
}
` closed_by_default="True" id="test2" closed_height="30" />
Text successfully copied to clipboard!
function lorem(ipsum, dolor = 1) {
const sit = ipsum == null ? 0 : ipsum.sit;
dolor = sit - amet(dolor);
return sit ? consectetur(ipsum, 0, dolor < 0 ? 0 : dolor) : [];
}