<div class="rh-button-circle rh-button-circle--default rh-button-circle--xlarge" tabindex="0">
    <span class="icon-chevron-up rh-button-circle__icon"></span>
</div>
<div class="{{className}} {{#if priority}}{{className}}--{{priority}}{{else}}{{className}}--default{{/if}} {{className}}--{{modifier}}{{#if hasBorder}} {{className}}--border{{/if}}{{#if extendClass}} {{extendClass}}{{/if}}" tabindex="{{#if tabIndex}}{{tabIndex}}{{else}}0{{/if}}">
    <span class="{{icon}}{{#unless isUnderLarge}} {{className}}__icon{{/unless}}"></span>
</div>
{
  "className": "rh-button-circle",
  "name": "default",
  "modifier": "xlarge",
  "icon": "icon-chevron-up",
  "extendClass": "",
  "isUnderLarge": false,
  "tabIndex": 0
}
  • Content:
    @mixin make-button-circle-size($button-size) {
    	height: $button-size;
    	min-height: $button-size; //Fix IE11
    	max-height: $button-size; //Fix IE11
    
    	width: $button-size;
    	min-width: $button-size; //Fix IE11
    	max-width: $button-size; //Fix IE11
    
    	@content;
    }
    
    $classname-button-circle: "rh-button-circle";
    .#{$classname-button-circle} {
    	/* Box-modell/beteende */
    	display: flex;
    	justify-content: center;
    	align-items: center;
    
    	/* Visuellt */
    	border-radius: 50%;
    
    	/* Typografi */
    	font-family: $BUTTON-CIRCLE__ICON--FONT-FAMILY;
    	text-decoration: none;
    
    	@if $BUTTON-CIRCLE__CURSOR {
    		cursor: $BUTTON-CIRCLE__CURSOR;
    	}
    
    	// Highlight
    	@if $BUTTON-CIRCLE--BORDER {
    		&--border {
    			border: $BUTTON-CIRCLE--BORDER;
    		}
    	}
    
    	// The empty class is needed when using large and xlarge sizes
    	&__icon {
    	}
    
        // Types
    	&--default {
    		/* Visuellt */
    		@if $BUTTON-CIRCLE--DEFAULT-BACKGROUND-COLOR {
    			background-color: $BUTTON-CIRCLE--DEFAULT-BACKGROUND-COLOR;
    		}
    
    		/* Typografi */
    		@if $BUTTON-CIRCLE__ICON--DEFAULT-COLOR {
    			color: $BUTTON-CIRCLE__ICON--DEFAULT-COLOR;
    		}
    
    		&:hover,
    		&:active,
    		&:focus {
    			/* Visuellt */
    			@if $BUTTON-CIRCLE--DEFAULT-HIGHLIGHT-BACKGROUND-COLOR {
    				background-color: $BUTTON-CIRCLE--DEFAULT-HIGHLIGHT-BACKGROUND-COLOR;
    			}
    
    			/* Typografi */
    			@if $BUTTON-CIRCLE__ICON--DEFAULT-HIGHLIGHT-COLOR {
    				color: $BUTTON-CIRCLE__ICON--DEFAULT-HIGHLIGHT-COLOR;
    			}
    		}
    	}
    
    	&--secondary {
    		/* Visuellt */
    		@if $BUTTON-CIRCLE--SECONDARY-BACKGROUND-COLOR {
    			background-color: $BUTTON-CIRCLE--SECONDARY-BACKGROUND-COLOR;
    		}
    
    		/* Typografi */
    		@if $BUTTON-CIRCLE__ICON--SECONDARY-COLOR {
    			color: $BUTTON-CIRCLE__ICON--SECONDARY-COLOR;
    		}
    
    		&:hover,
    		&:active,
    		&:focus {
    			/* Visuellt */
    			@if $BUTTON-CIRCLE--SECONDARY-HIGHLIGHT-BACKGROUND-COLOR {
    				background-color: $BUTTON-CIRCLE--SECONDARY-HIGHLIGHT-BACKGROUND-COLOR;
    			}
    
    			/* Typografi */
    			@if $BUTTON-CIRCLE__ICON--SECONDARY-HIGHLIGHT-COLOR {
    				color: $BUTTON-CIRCLE__ICON--SECONDARY-HIGHLIGHT-COLOR;
    			}
    		}
    	}
    
    	&--warning {
    		/* Visuellt */
    		@if $BUTTON-CIRCLE--WARNING-BACKGROUND-COLOR {
    			background-color: $BUTTON-CIRCLE--WARNING-BACKGROUND-COLOR;
    		}
    
    		/* Typografi */
    		@if $BUTTON-CIRCLE__ICON--WARNING-COLOR {
    			color: $BUTTON-CIRCLE__ICON--WARNING-COLOR; //false
    		}
    
    		&:hover,
    		&:active,
    		&:focus {
    			/* Visuellt */
    			@if $BUTTON-CIRCLE--WARNING-HIGHLIGHT-BACKGROUND-COLOR {
    				background-color: $BUTTON-CIRCLE--WARNING-HIGHLIGHT-BACKGROUND-COLOR;
    			}
    
    			/* Typografi */
    			@if $BUTTON-CIRCLE__ICON--WARNING-HIGHLIGHT-COLOR {
    				color: $BUTTON-CIRCLE__ICON--WARNING-HIGHLIGHT-COLOR;
    			}
    		}
    	}
    
    	// Sizes
    	&--small {
    		@include make-button-circle-size($BUTTON-CIRCLE--SMALL-SIZE);
    	}
    
    	&--medium {
    		@include make-button-circle-size($BUTTON-CIRCLE--MEDIUM-SIZE);
    	}
    
    	&--large {
    		@include make-button-circle-size($BUTTON-CIRCLE--LARGE-SIZE) {
    			.#{$classname-button-circle}__icon {
    				font-size: $BUTTON-CIRCLE__ICON--LARGE-SIZE;
    			}
    		}
        }
    
        &--xlarge {
    		@include make-button-circle-size($BUTTON-CIRCLE--XLARGE-SIZE) {
    			.#{$classname-button-circle}__icon {
    				font-size: $BUTTON-CIRCLE__ICON--XLARGE-SIZE;
    			}
    		}
    	}
    }
    
  • URL: /components/raw/button-circle/_button-circle.scss
  • Filesystem Path: components/Atoms/button-circle/_button-circle.scss
  • Size: 3.2 KB
  • Content:
    /* Atom - Button circle */
    // --------- Base settings ----------
    $BUTTON-CIRCLE--SMALL-SIZE: 1.875em; //30px
    $BUTTON-CIRCLE--MEDIUM-SIZE: 2.1875em; //35px
    
    $BUTTON-CIRCLE--LARGE-SIZE: 2.5em; //40px
    $BUTTON-CIRCLE__ICON--LARGE-SIZE: 1.2em;
    
    $BUTTON-CIRCLE--XLARGE-SIZE: 3.125em; //50px
    $BUTTON-CIRCLE__ICON--XLARGE-SIZE: 1.6em;
    // ------ End of base settings ------
    
    // --------- Common ----------
    $BUTTON-CIRCLE__ICON--FONT-FAMILY: $icon--font-family;
    $BUTTON-CIRCLE--BORDER: $border-thin--standard $base3-dark;
    $BUTTON-CIRCLE__CURSOR: false; //Ex: pointer
    // ------ End of common ------
    
    // --------- Variants ----------
    // Default style - HIGHLIGHT === :hover, :active, :focus
    $BUTTON-CIRCLE--DEFAULT-BACKGROUND-COLOR: $base3; //false
    $BUTTON-CIRCLE__ICON--DEFAULT-COLOR: $white; //false
    
    $BUTTON-CIRCLE--DEFAULT-HIGHLIGHT-BACKGROUND-COLOR: $base3-light; //false
    $BUTTON-CIRCLE__ICON--DEFAULT-HIGHLIGHT-COLOR: $base3-dark; //false
    
    // Secondary style
    $BUTTON-CIRCLE--SECONDARY-BACKGROUND-COLOR: $base3-light;
    $BUTTON-CIRCLE__ICON--SECONDARY-COLOR: $black; //false
    
    $BUTTON-CIRCLE--SECONDARY-HIGHLIGHT-BACKGROUND-COLOR: $base3; //false
    $BUTTON-CIRCLE__ICON--SECONDARY-HIGHLIGHT-COLOR: $white; //false
    
    // Warning style
    $BUTTON-CIRCLE--WARNING-BACKGROUND-COLOR: $warning-dark;
    $BUTTON-CIRCLE__ICON--WARNING-COLOR: $white;
    
    $BUTTON-CIRCLE--WARNING-HIGHLIGHT-BACKGROUND-COLOR: $warning;
    $BUTTON-CIRCLE__ICON--WARNING-HIGHLIGHT-COLOR: $white;
    // ------ End of variants ------
  • URL: /components/raw/button-circle/button-circle.settings.scss
  • Filesystem Path: components/Atoms/button-circle/button-circle.settings.scss
  • Size: 1.5 KB
  • Content:
    {
        "name": "regionhalland/button-circle",
        "description": "Button circle",
        "type": "styleguide-atom",
        "license": "GPL-3.0",
        "authors": [
            {
                "name": "Roland Hydén",
                "email": "Roland.Hyden@Regionhalland.se"
            }
        ],
        "require": {}
    }
  • URL: /components/raw/button-circle/composer.json
  • Filesystem Path: components/Atoms/button-circle/composer.json
  • Size: 291 Bytes

Button circle

  • Komponenten justerar automatiskt ikon i mitten och det ger bara en grund form för en flexibel återanvändning.
  • Komponents prefix: rh-button-circle*
  • Filplats: /components/Atoms/button-circle

1. Varianter

1.1. Typ

Klassnamn Fullständigt namn Beskrivning
--default rh-button-circle--default
--secondary rh-button-circle--secondary
--warning rh-button-circle--warning

1.2. Storlek

Klassnamn Fullständigt namn Mått i em Mått i pixel
--small rh-button-circle--small 1.875em 30px
--medium rh-button-circle--medium 2.1875em 35px
--large rh-button-circle--large 2.5em 40px
--xlarge rh-button-circle--xlarge 3.125em 50px

1.3. Med border

Klassnamn Fullständigt namn Beskrivning
--border rh-button-circle--border “Border” är runt om komponenten. Standard är utan “border”

3. Ikon

Klassen rh-button-circle__icon används för att man kan kontrollera ikons stil (storlek, färg o.s.v.). Klassen behövs också när man använder storlekarna --large och --xlarge.

Exempel:

<div class="rh-button-circle rh-button-circle--primary rh-button-circle--large">
    <span class="icon-arrow-right rh-button-circle__icon"></span>
</div>

TIPS! Man kan också justera ikons position genom att skapa egen CSS-klass och påverka padding* property. Se nedan för exempel:

.align-icon {
    padding-top: 0.1em;
}

<div class="rh-button-circle rh-button-circle--medium align-icon">
    <span class="icon-arrow-right"></span>
</div>

4. Användning

rh-button-circle <variant-typ> <variant-storlek>

4.1. Standard

<div class="rh-button-circle rh-button-circle--primary rh-button-circle--small">
    <span class="icon-plus"></span>
</div>

4.2. Border

<div class="rh-button-circle rh-button-circle--secondary rh-button-circle--large rh-button-circle--border">
    <span class="icon-arrow-right rh-button-circle__icon"></span>
</div>

4.3. Länkbar

Man kan också använda <a> tag runt om komponenten för att det blir länkbar.

<a href="#">
    <div class="rh-button-circle rh-button-circle--warning rh-button-circle--small">
        <span class="icon-plus"></span>
    </div>
</a>

5. Versionhistorik

2.0.1 (2020-01-23)

  • Förbättring av tabindex

2.0.0 (2020-01-22)

  • --default skapas.
  • Förbättring av variablers namn.
  • Globala variabler används.

1.2.0 (2019-12-17)

  • Nya varianten --warning har skapats.
  • Förbättring av:
    • .hbs och .config.json filer för att ge tydligare HTML i resultatet.
    • Stödja bättre :focus beteendet.

1.1.1 (2019-10-23)

  • Redigera ikonstorlek 1.4em -> 1.2em för en bättre passande
    • $button-circle--large-icon-font-size: 1.2em

1.1.0

  • Modifier --secondary introducerades.

1.0.0

  • Första version