Using Grommet for HPE?See Anchor examples and guidance.
How to align along the cross axis when contained in a Box or along the column axis when contained in a Grid.
string"start"
"center"
"end"
"stretch"
"baseline"
The DOM tag or react component to use for the element.
stringThe name of a component.
"div"
function() => {}component{Component}Label color and icon color, if not specified on the icon.
stringA hex, name, or rgb value.
"brand"
objectAn object with a color for dark and light modes.
{ dark: "string", light: "string" }The amount of spacing between icon and label in the anchor.
stringT-shirt sizing based off the theme or a specific size in px, em, etc.
"xxsmall"
"string"
Label text to place in the anchor.
string"Add"
elementA component used to display the label.
<Box>...</Box>
The amount of margin around the component.
string"none"
"xxsmall"
"xsmall"
"small"
"medium"
"large"
"xlarge"
objectCan be specified to distinguish horizontal margin, vertical margin, and margin on a particular side.
{
vertical: "...",
horizontal: "...",
top: "...",
bottom: "...",
left: "...",
right: "..."
}
Click handler. It can be used, for example, to add analytics and track who clicked in the anchor.
function( ) => { }Whether an icon and label should be reversed so that the icon is at the end of the anchor.
booleantrue
false
The font size is typically driven by the components containing this component. But, it can be adjusted directly via this size property, typically when it is not contained in a 'Heading', 'Paragraph', or 'Text'.
stringT-shirt sizing based off the theme or a specific size in px, em, etc.
"xsmall"
"small"
"medium"
"large"
"xlarge"
"xxlarge"
"12px"
At its core, the Anchor component is a regular <a> element. Thus, both DOM and React properties, methods, and events are accessible. To read up on all of the possible DOM attributes and types available for a elements, check out this MDN Web Documents page. To learn more about DOM events and methods, you can read more on the MDN Web Events documentation page.
Also, feel free to read about the types of React events available, or see how DOM attributes change in React. Working in tandem with Styled Components, you also have access to the as property.
The color of the label text and icon strokes.
stringA hex, name, or rgb value.
"brand"
objectAn object with a color for dark and light mode.
{"dark": "black", "light": "brand"}
The gap between the label and icon.
stringT-shirt sizing based off the theme or a specific size in px, em, etc.
"none"
"xsmall"
"small"
"medium"
"large"
"xlarge"
"20 px"
The color of the icon.
stringA hex, name, or rgb value.
"brand"
objectAn object with a color for dark and light modes.
{ dark: "string", light: "string" }The text decoration of the label. Refer to MDN for possible values.
string"none"
The text decoration of the label when hovering. Refer to MDN for possible values.
string"underline"
Any additional style for the Anchor when hovering.
stringAny CSS.
css`color: 'blue'`
function(props) => {}The color of the icon.
stringA hex, name, or rgb value.
"brand"
objectAn object with a color for dark and light mode.
{"dark": "black", "light": "brand"}
Any additional style for the Anchor.
stringAny CSS.
css`color: 'blue'`
function(props) => {}The color of the label text and icon strokes on different Anchor sizes. Size refers to the text size of the Anchor.
stringA hex, name, or rgb value.
"brand"
objectAn object with a color for dark and light mode.
{"dark": "black", "light": "brand"}
The gap between the label text and the icon on different Anchor sizes. Size refers to the text size of the Anchor.
stringT-shirt sizing based off the theme or a specific size in px, em, etc.
"none"
"xsmall"
"small"
"medium"
"large"
"xlarge"
"20 px"
The font weight of the label on different Anchor sizes. Size refers to the text size of Anchor.
number300
The text decoration of the label when hovering on different Anchor sizes. Size refers to the text size of Anchor.
string"underline"
The border color of the component when in focus.
stringA hex, name, or rgb value.
"focus"
objectAn object with a color for dark and light modes.
{ dark: "string", light: "string" }Focus styles for cases where focus indicator should be inset in the container.
objectAn object can contain a border, outline, shadow, and twoColor. The twoColor option enables a dual-color focus effect, usually rendered as layered outlines or shadows for enhanced contrast.
{
inset: {
border: {
color: 'focus',
},
outline: { color: 'focus', size: '2px', offset: '-2px' },
shadow: undefined,
twoColor: undefined,
},}The outline color around the component when in focus.
stringA hex, name, or rgb value.
"brand"
objectAn object with a color for dark and light modes.
{ dark: "string", light: "string" }The shadow color around the component when in focus.
string"focus"
objectAn object with a color for dark and light modes.
{ dark: "string", light: "string" }