Skip to content

Commit

Permalink
Document fill prop
Browse files Browse the repository at this point in the history
  • Loading branch information
colebemis committed Feb 23, 2021
1 parent 6efa7c2 commit 9fc8182
Showing 1 changed file with 28 additions and 9 deletions.
37 changes: 28 additions & 9 deletions docs/content/packages/react.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ npm install @primer/octicons-react
## Usage

### Icons

The `@primer/octicons-react` module exports individual icons as [named
exports](https://ponyfoo.com/articles/es6-modules-in-depth#named-exports). This
allows you to import only the icons that you need without blowing up your
Expand All @@ -34,6 +35,7 @@ If you were to compile this example with a tool that supports [tree-shaking][]
the "zap" and "beaker" icons.

### Vertical alignment

By default the octicons have `vertical-align: text-bottom;` applied as inline
styles. You can change the alignment via the `verticalAlign` prop, which can be
either `middle`, `text-bottom`, `text-top`, or `top`.
Expand All @@ -43,13 +45,13 @@ import {RepoIcon} from '@primer/octicons-react'

export default () => (
<h1>
<RepoIcon verticalAlign='middle' /> github/github
<RepoIcon verticalAlign="middle" /> github/github
</h1>
)
```


### `aria-label`

You have the option of adding accessibility information to the icon with the
[`aria-label` attribute][aria-label] via the `aria-label` prop.

Expand All @@ -64,25 +66,42 @@ export default () => (
)
```


### Sizes

The `size` prop takes `small`, `medium`, and `large` values that can be used to
render octicons at standard sizes:

| Prop | Rendered Size |
| :- | :- |
| `size='small'` | 16px height by `computed` width |
| Prop | Rendered Size |
| :-------------- | :------------------------------ |
| `size='small'` | 16px height by `computed` width |
| `size='medium'` | 32px height by `computed` width |
| `size='large'` | 64px height by `computed` width |
| `size='large'` | 64px height by `computed` width |

```js
// Example usage
import {LogoGithubIcon} from '@primer/octicons-react'

export default () => (
<h1>
<a href='https://github.com'>
<LogoGithubIcon size='large' aria-label='GitHub'/>
<a href="https://github.com">
<LogoGithubIcon size="large" aria-label="GitHub" />
</a>
</h1>
)
```

### Fill

The `fill` prop takes a string value that can be used to set the color of the icon.
By default, `fill` is set to `currentColor`, which means it inherits it's parent's text color.

```js
// Example usage
import {LogoGithub} from '@primer/octicons-react'
export default () => (
<h1>
<a href="https://github.com">
<LogoGithubIcon fill="#f00" />
</a>
</h1>
)
Expand Down

0 comments on commit 9fc8182

Please sign in to comment.