🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

selecto

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

selecto

Selecto.js is a component that allows you to select elements in the drag area using the mouse or touch.

1.26.3
latest
Source
npm
Version published
Weekly downloads
166K
0.79%
Maintainers
1
Weekly downloads
 
Created

What is selecto?

Selecto is a JavaScript library that allows users to select multiple elements by dragging a selection box over them. It is highly customizable and can be used in various scenarios such as image galleries, file managers, and more.

What are selecto's main functionalities?

Basic Selection

This feature allows users to select elements by clicking and dragging a selection box over them. The selected elements are highlighted by adding a 'selected' class.

const selecto = new Selecto({
  container: document.querySelector('.container'),
  selectableTargets: ['.selectable'],
  selectByClick: true,
  selectFromInside: true,
  hitRate: 100,
});

selecto.on('select', (e) => {
  e.added.forEach(el => el.classList.add('selected'));
  e.removed.forEach(el => el.classList.remove('selected'));
});

Custom Styling

This feature allows users to customize the appearance of the selection box by specifying styles such as border and background color.

const selecto = new Selecto({
  container: document.querySelector('.container'),
  selectableTargets: ['.selectable'],
  selectByClick: true,
  selectFromInside: true,
  hitRate: 100,
  selectionStyle: {
    border: '2px dashed #000',
    backgroundColor: 'rgba(0, 0, 0, 0.1)',
  },
});

Multiple Selection

This feature allows users to select multiple elements by holding down a modifier key (e.g., Shift) while clicking or dragging.

const selecto = new Selecto({
  container: document.querySelector('.container'),
  selectableTargets: ['.selectable'],
  selectByClick: true,
  selectFromInside: true,
  hitRate: 100,
  toggleContinueSelect: ['shift'],
});

selecto.on('select', (e) => {
  e.added.forEach(el => el.classList.add('selected'));
  e.removed.forEach(el => el.classList.remove('selected'));
});

Other packages similar to selecto

Keywords

select

FAQs

Package last updated on 03 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts