LogisBaseLogisBase

Button

<Button> is the standard button component. Supports types, sizes, icons, loading state, permission gating, tooltips, and analytics events.

<Button>

The standard button used everywhere in the LogisBase Console. Supports semantic types, sizes, icons, loading state, built-in permission checks, tooltips, and analytics events.

Basic Usage

<Button @text='Save' @onClick={{this.save}} />

<Button
  @type='primary'
  @icon='save'
  @text='Save Changes'
  @onClick={{this.save}}
/>

<Button @type='danger' @icon='trash' @text='Delete' @onClick={{this.delete}} />

Arguments

Visual

ArgumentTypeDefaultDescription
@typestringdefaultVisual variant — default, primary, secondary, success, warning, danger, magic
@sizestringsmxs, sm, md, lg, xl
@textstringButton label
@outlinebooleanfalseRender the outline variant
@responsivebooleanfalseHide the text on small screens (icon-only on sm:)
@wrapperClassstringExtra classes on the outer wrapper
@textClassstringExtra classes on the text span
@buttonTypestringbuttonThe native type attribute — button, submit, reset

Icon

ArgumentTypeDefaultDescription
@iconstringFontAwesome icon name (e.g. save, trash, plus)
@iconPrefixstringFontAwesome prefix — fas, far, fab, etc.
@iconSizestringForwarded to <FaIcon> (xs, sm, lg, 2x, etc.)
@iconRotationnumber90 / 180 / 270
@iconFlipstringhorizontal / vertical / both
@iconSpinbooleanSpin the icon
@iconClassstringExtra classes on the icon

Loading State

ArgumentTypeDefaultDescription
@isLoadingbooleanfalseShow a spinner instead of the icon and disable the button
@loaderWidthnumber14Spinner width in px
@loaderHeightnumber14Spinner height in px

Disabled / Visibility

ArgumentTypeDefaultDescription
@disabledbooleanfalseDisable the button
@visiblebooleantrueWhen false, nothing renders

Permissions

ArgumentTypeDescription
@permissionstringIf the current user lacks this ability, the button is auto-disabled and a "Unauthorized" tooltip is shown. Uses ember-can

Tooltip

ArgumentTypeDefaultDescription
@helpTextstringTooltip text shown on hover
@exampleTextstringOptional example shown beneath the help text
@tooltipPlacementstringtoptop, bottom, left, right

Callbacks

ArgumentSignatureDescription
@onClick(event)Called on click. Skipped when the button is disabled or loading
@onInsert()Called once after the button is inserted into the DOM

Analytics

ArgumentTypeDescription
@eventNamestringIf set, calls events.trackEvent(eventName, ...eventArgs) on click before invoking @onClick
@eventArgsarrayArgs to pass to trackEvent

Permission Gating

Pass @permission to gate the button on an ember-can ability:

<Button
  @type='danger'
  @icon='trash'
  @text='Delete'
  @permission='fleet-ops delete-driver'
  @onClick={{this.delete}}
/>

If the current user can't delete drivers, the button renders disabled with a "Unauthorized" tooltip — your @onClick will not fire even if disabling is somehow bypassed.

Loading State

<Button
  @type='primary'
  @icon='save'
  @text='Save'
  @isLoading={{this.isSaving}}
  @onClick={{this.save}}
/>

While loading, the icon is replaced with a spinner, the button is disabled, and clicks are ignored.

Yielding Custom Content

If @text is not enough — e.g. you need an icon between two pieces of text — yield a block:

<Button @type='primary' @onClick={{this.send}}>
  Send
  <FaIcon @icon='paper-plane' class='ml-2' />
</Button>

Real-World Examples

{{! Standard primary save button }}
<Button
  @type='primary'
  @icon='save'
  @text='Save'
  @isLoading={{this.isSaving}}
  @onClick={{this.save}}
/>

{{! Destructive action with permission check }}
<Button
  @type='danger'
  @icon='trash'
  @text='Delete'
  @permission='fleet-ops delete-driver'
  @helpText='Permanently delete this driver'
  @onClick={{this.confirmDelete}}
/>

{{! Submit button inside a form }}
<Button @buttonType='submit' @type='primary' @text='Submit' />

{{! Icon-only "Add" button }}
<Button @type='primary' @icon='plus' @size='xs' @onClick={{this.addRow}} />

{{! Responsive button — full text on desktop, icon-only on mobile }}
<Button
  @type='primary'
  @icon='filter'
  @text='Filters'
  @responsive={{true}}
  @onClick={{this.openFilters}}
/>

{{! Outline variant }}
<Button
  @type='primary'
  @outline={{true}}
  @text='Cancel'
  @onClick={{this.cancel}}
/>

Source

Button | LogisBase