Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added cursor utility class for "cursor" property #39701

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion scss/_utilities.scss
Expand Up @@ -799,8 +799,15 @@ $utilities: map-merge(
property: z-index,
class: z,
values: $zindex-levels,
)
),
// scss-docs-end utils-zindex
// scss-docs-start utils-cursor
"cursor": (
property: cursor,
class: cursor,
values: auto default none context-menu help pointer progress wait cell crosshair text vertical-text alias copy move no-drop not-allowed grab grabbing e-resize n-resize ne-resize nw-resize s-resize se-resize sw-resize w-resize ew-resize ns-resize nesw-resize nwse-resize col-resize row-resize all-scroll zoom-in zoom-out,
)
// scss-docs-end utils-cursor
),
$utilities
);
171 changes: 171 additions & 0 deletions site/content/docs/5.3/utilities/cursor.md
@@ -0,0 +1,171 @@
---
layout: docs
title: Cursor
description: Use these shorthand utilities for quickly configuring how the cursor looks like when hovering an element.
group: utilities
toc: true
---

## How it works

Adjust the `cursor` property on the fly with thirty six default values and classes. These classes are not responsive by default.

<div class="bd-example d-flex flex-column">
<div class="cursor-auto p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-auto</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-default p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-default</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-none p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-none</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-context-menu p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-context-menu</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-help p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-help</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-pointer p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-pointer</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-progress p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-progress</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-wait p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-wait</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-cell p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-cell</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-crosshair p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-crosshair</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-text p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-text</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-vertical-text p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-vertical-text</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-alias p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-alias</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-copy p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-copy</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-move p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-move</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-no-drop p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-no-drop</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-not-allowed p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-not-allowed</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-grab p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-grab</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-grabbing p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-grabbing</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-e-resize p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-e-resize</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-n-resize p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-n-resize</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-ne-resize p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-ne-resize</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-nw-resize p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-nw-resize</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-s-resize p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-s-resize</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-se-resize p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-se-resize</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-sw-resize p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-sw-resize</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-w-resize p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-w-resize</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-ew-resize p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-ew-resize</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-ns-resize p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-ns-resize</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-nesw-resize p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-nesw-resize</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-nwse-resize p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-nwse-resize</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-col-resize p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-col-resize</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-row-resize p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-row-resize</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-all-scroll p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-all-scroll</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-zoom-in p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-zoom-in</code> on an element. Hover over it and see the cursor.
</div>
<div class="cursor-zoom-out p-3 mb-3 mb-md-0 me-md-3 bg-body-tertiary">
This is an example of using <code>.cursor-zoom-out</code> on an element. Hover over it and see the cursor.
</div>
</div>

```html
<div class="cursor-auto">...</div>
<div class="cursor-default">...</div>
<div class="cursor-none">...</div>
<div class="cursor-context-menu">...</div>
<div class="cursor-help">...</div>
<div class="cursor-pointer">...</div>
<div class="cursor-progress">...</div>
<div class="cursor-wait">...</div>
<div class="cursor-cell">...</div>
<div class="cursor-crosshair">...</div>
<div class="cursor-text">...</div>
<div class="cursor-vertical-text">...</div>
<div class="cursor-alias">...</div>
<div class="cursor-copy">...</div>
<div class="cursor-move">...</div>
<div class="cursor-no-drop">...</div>
<div class="cursor-not-allowed">...</div>
<div class="cursor-grab">...</div>
<div class="cursor-grabbing">...</div>
<div class="cursor-e-resize">...</div>
<div class="cursor-n-resize">...</div>
<div class="cursor-ne-resize">...</div>
<div class="cursor-nw-resize">...</div>
<div class="cursor-s-resize">...</div>
<div class="cursor-se-resize">...</div>
<div class="cursor-sw-resize">...</div>
<div class="cursor-w-resize">...</div>
<div class="cursor-ew-resize">...</div>
<div class="cursor-ns-resize">...</div>
<div class="cursor-nesw-resize">...</div>
<div class="cursor-nwse-resize">...</div>
<div class="cursor-col-resize">...</div>
<div class="cursor-row-resize">...</div>
<div class="cursor-all-scroll">...</div>
<div class="cursor-zoom-in">...</div>
<div class="cursor-zoom-out">...</div>
```

Using Sass variables, you may customize the cursor utilities by changing the `$cursors` variable in `_variables.scss`.

## CSS

### Sass utilities API

Cursor utilities are declared in our utilities API in `scss/_utilities.scss`. [Learn how to use the utilities API.]({{< docsref "/utilities/api#using-the-api" >}})

{{< scss-docs name="utils-cursor" file="scss/_utilities.scss" >}}
1 change: 1 addition & 0 deletions site/data/sidebar.yml
Expand Up @@ -122,6 +122,7 @@
- title: Background
- title: Borders
- title: Colors
- title: Cursor
- title: Display
- title: Flex
- title: Float
Expand Down